hanneskod / libmergepdf

PHP library for merging multiple PDFs
390 stars 77 forks source link

Unable to find PDF file header #52

Closed AlessandroCuba closed 4 years ago

AlessandroCuba commented 4 years ago

I always get the same error. The PDFs are 1.7 and individually I can get them without problems.

`$pdfMerge = new Merger(); $curl = $this->createCurlObject();

    foreach ($pdfs as $pdf){
        try {
            $file = tempnam(sys_get_temp_dir(), 'DOC');
            $curl->download($pdf->url, $file);
            $pdfMerge->addFile($file);
          .....

`

when I make the merge and try to return, the error comes

return $pdfMerge->merge() ==> Unable to find PDF file header

PHP 7.0.33-1~dotdeb+8.1 with libmergepdf version 3.1.1

hanneskod commented 4 years ago

If you can downlad the files manually and then merge them without error it is not an issue with this library, but rather something with to downloading strategy. I'm closing for now. Feel free to reopen if you find a specific library error.