We encounter an issue with PDFs we generate with PDFNet when those files are validated by another company which is using IText says. Their error is:
java.io.IOException: trailer not found.
at com.lowagie.text.pdf.PdfReader.rebuildXref(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source)
at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
Indeed, the PDFs don't contain the "trailer" when we edit them with a textpad.
Browsing different forums and PDf guides and references, we couldn’t find if the "trailer" is mandatory or if the validation performed by IText is Invalid.
Can you please provide us some help with this ?
Do you know if it’s a bug or if we’re building our PDF the wrong way ?
Or do you have any reference proving that the « trailer » is no longer necessary ?
--------------
A:
Starting with PDF 1.5 (Acrobat 6) trailer is no longer required. This also applies to ISO32000 as well as PDF/A-2 & 3. I suppose this is a bug in itext.
In any case you can save your file with e_compatibility flag in PDFDoc.save(). For example:
doc.save(("my.pdf"), SDFDoc.e_compatibility, null);
This will disable generation of compressed object and may result in bigger files, but should be compatible with very old software.