Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

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

44 sec read

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?



Our software libraries allow you to

Convert PDF files to HTML
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Read and write HEIC and other Image formats in Java
Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.