Sophia Howard Sophia Howard is part of the Marketing, Sales and Website development 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.

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Sophia Howard Sophia Howard is part of the Marketing, Sales and Website development team at IDRsolutions

How to set up Jenkins in five minutes.

Recently we have been joined by Rudairo J Chitsenga who has spent some time with us having completed a course in software testing. During...
Guest Blogger
2 min read

Leave a Reply

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

IDRsolutions Ltd 2019. All rights reserved.