aspose file tools
The moose likes I/O and Streams and the fly likes Need help on resolving java.io.IOException: trailer not found. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Reply Bookmark "Need help on resolving java.io.IOException: trailer not found." Watch "Need help on resolving java.io.IOException: trailer not found." New topic
Author

Need help on resolving java.io.IOException: trailer not found.

Ramasamy Anbalagan
Greenhorn

Joined: Dec 14, 2009
Posts: 20
Hello guys,

I have been receiving below error while reading pdf document using iText api.

Error:
------
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)
at com.emc.documentum.pss.common.pdfapi.itext.PssESignGeneratorItext.addESignPages(PssESignGeneratorItext.java:731)

Code line:
----------

FileInputStream fileInputStream = new FileInputStream(signPdfName);
srcPDFReader = new PdfReader(fileInputStream); <Exception throwing on this line>.

Can any one help on this, how to resolve this issue.

It has been working for some pdf files and not working for some files.

Deepak Rao
Ranch Hand

Joined: Jan 24, 2012
Posts: 31

Ramasamy,

This seems like a format problem of the pdf. Were the pdf's too created using iText?
Ramasamy Anbalagan
Greenhorn

Joined: Dec 14, 2009
Posts: 20
Hey Deepak,

Thanks for quick turn around on this.

I believe the document was not created by iText. It was published through some tool i think.

I have investigated something on this issue like "trailer" would be part of the PDF Spec which would be added to the document @ the time of creation. Suspecting document not created properly...I am not sure on this.
Do you have any idea how we can see the “trailer” on PDF Spec.

Thanks.Anbalagan
Deepak Rao
Ranch Hand

Joined: Jan 24, 2012
Posts: 31

I feel the problem is in the files as some files are opening and some not.
Just curious to know if these files open in acrobat?

You can also try opening the pdf file in a textpad/notepad and search for "trailer".It will be there before the eof.

It will look like this

============
trailer
<<
/Size 46
/Root 1 0 R
/Info 45 0 R
>>
startxref
74012
%%EOF
==============
You can then compare them against the files which work.

Thanks
Deepak
 
 
subject: Need help on resolving java.io.IOException: trailer not found.
 
Threads others viewed
Applet doesn't load
Access denied error for midi file in same directory as applet!
Help wanted: password protect a document
java program to password protect a signed pdf file using itext pdfstamper
Page Count in PDF document
developer file tools