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.

There is more than one PDF file specification

1 min read

One of the really annoying thing about working with PDF is that there is actually more than one PDF file specification.

First of all, there is the very long Adobe PDF Reference Produced by Adobe. This freely available document is very long, detailed and often rather cryptic. Sometimes you need to hunt through alsorts of minor appendices to find out a specific case or you can find information is missing.

Today I was debugging some code to read the Hint stream in a Linearized Object – this allows a PDF viewer to display pages before the document has finished loading. This object consists of a set of variable bit length values split into sub-tables. It seems that while the values are packed together into a bitstream, the sub-tables themselves must be byte aligned. I could not find any mention of this is the spec – it was an intuitive guess on my part to try it.

The second PDF File Specification is what works in Acrobat. We had an interesting case last week of a file which did not work in our JPedal reader but opened in Acrobat. When we hunted it down, the reason turned out to be that the Specification says all PDF files end with the characters %%EOF – this file ended %%EO but still worked. So it seems, that in this case the real specification is a guideline and not a rule.

So, if you are working with PDF files, always keep a copy of the specification handy – the printed copy also double up as an excellent doorstop or monitor stand. But also make sure you have a copy of Acrobat handy and be prepared to find rules can be interpreted rather loosely.

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!



Are you a Developer working with PDF files?

Our developers guide contains a large number of technical posts to help you understand the PDF file Format.

Find out more about our software for Developers

Convert PDF to HTML5 or SVG Convert PDF to HTML5 or SVG
Convert AcroForms and XFA to HTML5Convert AcroForms and XFA to HTML5
Java PDF SDK for working with PDF files Java PDF SDK for working with PDF files
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.

Leave a Reply

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

IDRsolutions Ltd 2021. All rights reserved.