I'm trying to merge multiple PDFs with MultiMerge mergePdf() function, which works most of the time. In a specific case/file, the process fails with this error:
Fatal error: Uncaught exception 'Exception' with message 'TCPDF_PARSER ERROR: decodeFilterFlateDecode: invalid code'
I've followed the tutorial here:
https://www.phpdocx.com/documentation/cookbook/repair-PDF
and in case the merging process fails, I automatically repair all pdfs with pdftocairo then I try to merge again. WIth the repaired PDFs now I get to a different error, an infinite loop crash:
http://prntscr.com/1qiino1
Furthermore, I discovered that even with good files that can be merged by phpdocx, if I go through the pdftocairo repair process before, I get to the exact same infinite loop that ends with an out of memory error.
Is this a corrupted file issue, pdftocairo messes up the files worse than they are? Both the original and the repaired pdfs open fine in readers, browsers, etc. Has anyone experienced anything similar? I can provide the file in case on private if needed.