Sophia Matarazzo

Sophia is a part of the Marketing and Sales team at IDRSolutions.

Going beyond the PDF Spec to get a PDF to work

1 min read

Here at IDRSolutions we provide support for both JPedal our java PDF library  and  JPDF2HTML5 which allows you to convert your PDF files to HTML5.

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.

BlackIs1

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.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the  Blog RSS.

Sophia Matarazzo

Sophia is a part of the Marketing and Sales team at IDRSolutions.

Leave a Reply

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