libmergepdf icon indicating copy to clipboard operation
libmergepdf copied to clipboard

Merge a merged file

Open josepanta opened this issue 2 years ago • 2 comments

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

$pdfMerger->addFile($archivo);

josepanta avatar Jul 16 '21 06:07 josepanta

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

PierreLebedel avatar Oct 14 '21 15:10 PierreLebedel

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.

SpicyTacos23 avatar Jan 10 '22 17:01 SpicyTacos23