Reputation: 9
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
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
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