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.

What are Form XObjects?

44 sec read

Form XObjects (not be confused with forms which are buttons, checkboxes, buttons, etc) are an advanced feature of the PDF file format. They can be thought of as sub-rountines (or even mini-PDFs) which are used on the main PDF display.

In the PDF command stream, a Do command can either reference and Xobject containing an Image or a Form.

Both are defined in the Resources object. XForm objects can have their own Resources (fonts and images,etc) and even XForm objects. They also have a name (ie Fm1). So if you see Do /Fm1 in the PDF command stream, it is probably a form. Like images, they will be scaled and rotated using the current GraphicState settings but they offer more flexibility.

Here is what you might see in the Object tree (shown in Acrobat for a Form). Note it has a content stream of commands (which I have not shown).

Like images, this allows you to save space by reusing the Object over and over again. It is also popular with PDF creation tools because it allows you to logically separate out blocks – for example flattened form data, stamps or any logical item can be created as an Form XObject, complete with its own fonts and resources.



Our software libraries allow you to

Convert PDF files to HTML
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Read and write HEIC and other Image formats in Java
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.