0
votes

I create a PDF with TCPDF in PHP. All seems working fine on different browsers in Windows 8 and most browsers in windows 10.

However when using Windows 10 + Firefox + Adobe Reader, it returns the message that the PDF-file is corrupt. If I'm running the same with Windows 10 + Firefox + TwinUI viewer, it works normally.

Is there a specific parameter that must be added to the tcpdf script? Or is there a problem with acrobat reader in windows 10?

2
How are you sending the file to the browser? Are you using the Output() method with 'I' as the second parameter, or setting the headers manually and sending the data yourself? - JamesG

2 Answers

0
votes

Try to output PDF to file $pdf->Output('example_001.pdf', 'I');, and then open it with Adobe Reader, Firefox, Google Chrome on another computer. If it will work fine, the problem in your OS.

0
votes

Your description is using the terms Reader and Acrobat interchangeably, though they're not the same. If you are in fact running Acrobat when getting the file-corrupt popup warning, use Acrobat's Pre-flight PDF Syntax analyzer (Tools -> Print Production -> Preflight -> PDF analysis -> Report PDF syntax issues) to see if it will give you further details.

Other PDF viewing utilities may choose to ignore the problem and not tell you about it, especially if it will not affect rendering for viewing, but Acrobat (and perhaps Reader as well) are pickier about flagging problems detected when parsing the input document.

Finally, if you're in an Acrobat session that's given you the complaint about the document, try doing a SaveAs to another PDF filename, then see if that new output file will generate the same complaints when opened in a fresh session. Acrobat may do certain repairs on the fly, depending on the nature of the problem with the input.