| Issue 42: | Missing trailer after optimization | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? 1. python pdfsizeopt.py --use-pngout=false --use-jbig2=false soubor.pdf What is the expected output? What do you see instead? At the end of PDF should be trailer indicating what is the start point of the document and it is missing. When you use program working with IText as library for manipulating with PDF documents I get exception which indicates missing trailer (I confirmed it using vim editor). Exception from the tool called pdfsign using IText is: com.itextpdf.text.exceptions.InvalidPdfException: trailer not found. at com.itextpdf.text.pdf.PdfReader.rebuildXref(PdfReader.java:1566) at com.itextpdf.text.pdf.PdfReader.readPdf(PdfReader.java:521) at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:172) at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:161) at cz.dml.pdfsign.PDFSigner.sign(PDFSigner.java:65) at cz.dml.pdfsign.Main.main(Main.java:51) What version of the product are you using? On what operating system? I am using the newest version in repository on Ubuntu 10.10 Please provide any additional information below. item.pdf is file before running pdfsizeopt (it still has trailer) item.pso.pdf is PDF file after running pdfsizeopt (trailer is missing)
May 23, 2011
Project Member
#1
pts...@gmail.com
Status:
Done
May 23, 2011
iText developers are not completely sure the pdfsizeopt-processed PDF file is valid: http://sourceforge.net/tracker/?func=detail&aid=3306273&group_id=15255&atid=115255
May 23, 2011
This is a bug in whatever software created item.pso.pdf Read section 7.3.8 of ISO-32000-1 on the subject of stream objects: There should be an end-of-line marker after the data and before endstream; this marker shall not be included in the stream length. An end-of-line marker consists of either a CARRIAGE RETURN and a LINE FEED or just a LINE FEED, and not by a CARRIAGE RETURN alone. If you look at the xref stream of item.pso.pdf (and the other streams), you see that the end-of-line marker is missing: ÷+QN^²xendstream endobj
May 23, 2011
Thank you very much for the help, I will try to automatically repair the end-of-line marker which I expect to solve this problem.
May 23, 2011
pdfsizeopt.py generates PDFs which conform to http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf , which says in 3.2.7: It is recommended that there be an end-of-line marker after the data and before endstream; this marker is not included in the stream length. It would be a nice new optional feature to make pdfsizeopt.py conform to ISO-32000-1 though.
Labels:
-Type-Defect Type-Enhancement
|