Mark Stephens I have been working with Java and PDF since 1999 and am a big NetBeans fan. I enjoy speaking at conferences. I have an MA in Medieval History and a passion for reading.

Interesting PDF bugs – an extreme case of recursion

43 sec read

PDF files have a very useful feature known as XForms, which are sub-procedures. This makes it very easy to reuse code and produce smaller files. XForms can be thought of as fragments of PDF pages in their own right, with their own images and fonts and other resources, which can then be drawn onto the main page. In general they also inherit data from the main page. So if the XForm makes a call to Font TT1, it sees if it is defined in the XForm and looks in its parent if not.

However, here is an interesting XForm. It loads ant XForm called xi0. And guess what xio does? It loads a form called xio… There is no local definition of xi0 – so we default back to the main definition of xio (and round we go).

Adobe reports an error in this file and it is reasonably easy to add a check to stop this, but it is very annoying…

The PDF file format is a very powerful format but with power comes responsibility.

This article is part of a series on the more ‘unusual’ PDF files we come across while developing our PDF library. Click here for the full list.

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.

Mark Stephens I have been working with Java and PDF since 1999 and am a big NetBeans fan. I enjoy speaking at conferences. I have 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 2019. All rights reserved.