No Startxref found in last 1024 bytes opening file – what does this error message mean with a PDF file?

A PDF file contains a couple of key pointers. One of them is a pointer to the start of the table which describes the structure of the PDF file. By convention, this is needs to be located in the last 1024 bytes of the  PDF file. So the error is that this cannot be found. The common reasons for this are:-

1. The PDF file is corrupt.  Does it open in Adobe Acrobat? You are streaming it as a byte stream?
2. The file is being read into a stream and the end bytes have not been read properly. Do you flush and close the stream?
3. The PDF is being read into a fixed buffer which is larger than the file and there is empty space at the end.
4. The is something odd in the PDF file and we need to tweak our parser. The PDF spec is not strictly enforced so Adobe Acrobat will often open files which do not meet the spec. We need to figure it out.

If you are streaming the PDF files a useful sanity check is to write the data back to a file and see if it still opens.

Are there any cryptic PDF messages you would like us to explain?

This post is part of our “Understanding the PDF File Format” series. In each article, we discuss a PDF feature, bug, gotcha or tip. If you wish to learn more about PDF, we have 13 years worth of PDF knowledge and tips, so click here to visit our series index!

Related Posts:

The following two tabs change content below.

Mark Stephens

System Architect and Lead Developer at IDRSolutions
Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.
Markee174

About Mark Stephens

Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX.

He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>