I had an intriguing PDF bug to hunt down today. Any PDF file defines a pointer at the end of the file which points to the data structures inside the PDF. This is the startxref value in the last 1000 bytes of the file. Here is an example.
0000113537 00000 n trailer << /Size 74 /Root 33 0 R /Info 1 0 R /ID [ <0e208555874758e6f5945d00d352d90e> <0e208555874758e6f5945d00d352d90e> ] >> startxref 113735 %%EOF
Now here is the file I have been looking at
0000221725 00000 n trailer << /Size 4 /Root 1 0 R >> startref 66913784 %%EOF
Note the subtle difference? This file opens in Acrobat though so while the spec specifies one value, alternatives are allowed. So much for clear standards!
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!
Latest posts by Mark Stephens (see all)
- My experience of a Turkish bath (visiting Istanbul for DevFest) - November 24, 2017
- My 5 key takeaways from JavaOne 2017 - October 6, 2017
- My notes and pictures from thursday JavaOne 2017 - October 5, 2017
- My notes and pictures from Wednesday JavaOne 2017 - October 5, 2017
- My notes and pictures from Tuesday JavaOne 2017 - October 4, 2017