There are a wide variety of PDF creation tools out there and usually these tools generate the PDF’s content in a slightly different way to each other. As a general rule, developers who create PDF tools should follow the general content structure that is outlined in Adobe’s PDF Specification but sometimes a tool might work slightly differently.
All of the products we have developed abide by what is in Adobe’s PDF Spec. This means if someone has created a PDF using a tool which doesn’t follow what the spec defines, then inconsistencies are caused and the PDF might not be displayed properly.
As an example of us having to go beyond the PDF Spec to get a PDF file to work. We recently received a support ticket from one of our clients who was asking why his PDF file was not displaying an image correctly.
After spending a short amount time debugging and looking into what was causing this issue, we found out that the parameter BlackIs1 was being set to 0.
The next step for us was to take a look at our code to see what values we were allowing for. In our code base we found that we were expecting a boolean value (true or false).
To clarify what value we should be allowing for, we decided to take a look at what the PDF spec defined.
We can see from the image above that BlackIs1 is a boolean value and its default value is set to false. We can only imagine that this has been misinterpreted by the developer of the PDF creation tool, and they have set the value to 0 instead of false, and so that is why the PDF file was not being displayed correctly. We have now adapted our code base to allow for this inconsistency so that we will not have this issue again with any other PDF created using that tool.
This was a good insight into having to go beyond the PDF Spec to get a PDF file to work.
IDRsolutions develop a Java PDF library, a PDF forms to HTML5 converter, a PDF to HTML5 or SVG converter and a Java Image Library that doubles as an ImageIO replacement. On the blog our team post about anything interesting they learn about.