1

Hi im trying to merge two pdf files with pdfmerger. My code is

include './PDFMerger/PDFMerger.php';

$pdf = new PDFMerger;

$pdf->addPDF('temp/pdf.pdf', 'all');
$pdf->addPDF('temp/pdf2.pdf', 'all');
$pdf->merge('file', 'test.pdf');

(both pdfs has only 1 page, but with some filled input forms) I have managed to solve deprecate warning with Merge PDF files with PHP however FPDF error: Unable to find object (88, 0) at expected location remains. Any idea or alternative would help a lot, but installing things on server is not an option for me.

Community
  • 1
  • 1
Newb
  • 27
  • 1
  • 6
  • Coulld you show us pdf.pdf or pdf2.pdf? Btw: The PDFMerger class uses a 5 years (!!) old version of FPDI. You should try an up-to-date version frist! Here's a [concatenation demo](http://www.setasign.com/products/fpdi/demos/concatenate-fake/) without the PDFMerger class. – Jan Slabon Sep 26 '14 at 00:53

1 Answers1

0

Your PDF might have errors, other people has the same problem, solutions are developped here : TCPDF ERROR: Unable to find object (8, 0) at expected location
Since you can't install anything on your server, you might can't use command line on it too, so the solution of skipping the error by editing FDPF source should be the one you can test & use.

EDIT : this was the link I wanted to give : How to skip over corrupt files with PHP libraries TCPDF and FPDI by modifying error handling?

Community
  • 1
  • 1
Veve
  • 6,643
  • 5
  • 39
  • 58
  • Yes i can edit, test, use pdf file. but i have no ide how to fix it. I dont know the correct settings to use – Newb Sep 25 '14 at 09:21
  • I really need a way to fix these pdf. The script you linked only deleted file and added nothing new – Newb Sep 25 '14 at 09:34
  • Yes the link deals about the FPDF error, as asked in your question. Where your PDF come from? If you made them, have you tried to save them with a different PDF format/version? Can you make them with a different software? – Veve Sep 25 '14 at 10:09
  • I added another link to my previous answer, with the solution to skip the error by editing FPDF source. – Veve Sep 25 '14 at 10:13
  • I could use only linux shell but i cant get it to output anything..$cmd = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outputName "; foreach ($fileArray as $file) { $cmd .= $file . " "; } $result = shell_exec($cmd);*/ Im running centOS – Newb Sep 25 '14 at 10:45
  • As asked before, where these PDF come from? Have you tried to save/make them with a different software, different PDF format? – Veve Sep 25 '14 at 11:26
  • They are some contracts i have to fill with my webpage. I added fields with acrobat pro and compressed with pdftk and then used this website http://www.weenysoft.com/pdf-repair-online.php to fix xref tables which got broken somehow with pdftk – Newb Sep 25 '14 at 11:31