Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Adding a PDF file Debugger to JPedal PDF Viewer

1 min read

Why is a PDF file debugger useful?

PDF files are complex and can go wrong in lots of ways. We have been writing JPedal since 2001 and still have to tweak our parser sometimes to handle files which often have very ‘liberal’ interpretations of the PDF File format specification.

There are a number of tools out there to help with debugging PDF files (we are big Rups fans), and (as we discovered at the recent PDF Days conference), lots of developers other than us who still open up the raw files in a text editor to investigate.

Over the years we have built in a large number of hidden debug tools in JPedal, but never exposed any features to debug PDF files and explore their structure. So we have decided it is overdue we added it into our Java PDF Viewer, both for our benefit and anyone else who wants to play with PDF files.

So this JPedal release sees a new debug mode build into the Java Viewer. This will allow you to inspect the inner workings of the PDF file and debug how it works. This is the first release, and currently we have just added an XREF viewer. We plan to add new features with later releases (think of this as just the MVP).

How do I use the PDF Debugger?

The easiest way to use the debugger is to run the Viewer in Inspect mode. You will need to download a copy of the jar from our website. It will work with both the full and the trial jar (so you do not need to be a customer to use it).

java -jar jpedal.jar --inspect

This will start JPedal in a mode which allows you to open files but removes most of the other Viewer features to keep it simple.
JPedal debugger

Open a file and select the View menu option
JPedal debugger 2

This allows you to view the stream contents. We currently display the binary content in blue as hex values and have plans to colour the Dictionary values to make it clearer.
JPedal debugger 3

Future plans?

We currently have lots of ideas for features such as displaying the PDF file Cos data, validating against the Arlington model and having a single step execution of Content commands with the Viewer display the results so far.

But we would also love to have your ideas and feedback! What features would you like to see added?



Do you need to solve any of these problems?

Display PDF documents in a Web app
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java

Are you a Developer working with PDF files?

Learn more about PDF file format
Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Leave a Reply

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

IDRsolutions Ltd 2022. All rights reserved.