I have been looking at a PDF file which did not open in our Java Viewer. The issue turned out to be that we were misreading a rather crucial text string. In general, text values are defined in 2 ways:-
1. Encoded text characters (if it is WIN encoded it will look like standard text).
(this is a text stream)
2. Hex values (a set of 2 letter hex entries)
The offending String (it is the /U value which is used to decrypt the file) initially looked like case 2 until I opened it up in a hex editor. The last part of the input includes a long stream of zero byte values until you then each the closing > tag.
The way to handle this appears to be to just ignore these values – I suspect they are there because the PDF creation library (ISIS information Systems according to the file) is writing out a fixed length string value. Easily fixed with a simple code tweak but it is a shame to find garbage which we then have to ignore.
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)
- How we are improving our code quality with IDEA in 2018 - March 7, 2018
- How we are improving our code quality with NetBeans in 2018 - March 1, 2018
- 3 ways that the European Union is changing the way Companies write software in 2018 - January 31, 2018
- IDRsolutions product range update for 2018 - January 22, 2018
- 4 ways Companies can make remote working successful - December 21, 2017