Prabu
Prabu

Reputation: 9

FPDF-Merge Error: Number of objects (22) differs with number of xrefs (23), something , pdf xref table is corrupted :(

I need to fill a pdf existing form in dynamically & used fpdm in pdf form fill in PHP.

/***************************
  Sample using a PHP array
****************************/    
require('fpdm.php');    
$fields = array(        
    'EmpNo'  => '1234',
    'EmpName' =>'XXXX' 
);
$pdf = new FPDM('EmpDetails.pdf');
$pdf->Load($fields, false); // second parameter: false if field values are in ISO-8859-1, true if UTF-8
$pdf->Merge();
$pdf->Output();
?>

Existing Pdf form template showing error:

FPDF-Merge Error: Object streams are not supported

Downloaded pdftk tool kit and convert file Showing:

FPDF-Merge Error: Number of objects (22) differs with enter code here number of xrefs (23), something , pdf xref table is corrupted :(

Upvotes: 0

Views: 5676

Answers (3)

Tanupriya
Tanupriya

Reputation: 167

For rooting out this menace , we also required to install pdftk server.

1- Then type the following command in cmd as: pdftk EmpDetails.pdf output fixed.pdf and issue will be fixed.

We can refer https://www.pdflabs.com/docs/pdftk-cli-examples/ for more functionalities

Edit: 2024

You dont need to have the pdftk server, you can do it with the free version as well and run the command as mention above

PS: Make sure when you install pdftk free to click on adding to environment variables otherwise full path to pdftk must be included in the path

Upvotes: 2

Amar Khouni
Amar Khouni

Reputation: 9

to resolve this problem, you need to open your PDF file with a text editor and add an empty object like this

23 0 obj 
<<
>>
endobj

Upvotes: 0

wamaro
wamaro

Reputation: 121

As found here, you need to change the 'Advanced' settings of PDFtk as following.

Note: This is only available in PDFtk Pro.

'Advanced output options:' %PDFTK% %PDFIN% output %PDFOUT%

In my installation, this was the default value.

enter image description here

Upvotes: -1

Related Questions