hanneskod/libmergepdf

Merge a merged file

Opened this issue · 2 comments

$pdfMerger->addFile("archivo1.pdf");
$pdfMerger->addFile("archivo2.pdf");
$archivo = $pdfMerger->merge();

$pdfMerger->addFile($archivo);

@josepanta I think you should use the addRaw() method (instead of the addFile() one) to put the contents returned by merge()

I'm having problems merging merged files.

Trying the regular:

 $merger = new Merger();
/...
$merger->addFile($tmp_filename);
.../
 $merged_file = $merger->merge();

And got the following Exception:

'This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI. (See https://www.setasign.com/fpdi-pdf-parser for more details)'

Then i tried one of the possible solutions for the TCPDI Merger in here https://packagist.org/packages/iio/libmergepdf

Merging pdfs of version 1.5 and later
The default FPDI driver is not able handle compressed pdfs of version 1.5 or later. Circumvent this limitation by using the slightly more experimental TCPDI driver.

Known issues:
TCPDI (as used in the TcpdiDriver for merging pdfs with newer features) does not seem to be maintained. This makes mergeing fragile for certain kinds of files, and error messages are often all but helpful. This package will not be able to fix issues in TCPDI. The long term solution is to switch to a different backend. Suggestions are very welcomed!

Tried using
$merger = new Merger(new TcpdiDriver());
But did not work.

Any suggestions?
Thanks.