Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX.

He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

Embedding your own data in PDF files

September 29, 2010 1 min read

Because of its power and flexibilty, the PDF file format is often used for Internal workflows. Sometimes it would be useful to embed your own data within the PDF itself. Generally this information will be ignored by most tools and the PDF remains usable as an ordinary PDF. Here are some ideas on how you can do this.

The XML metafile

You can embed a XML file as part of the PDF metadata. This can contain just about any extra tags so it is an ideal place to bury data about the whole file.

Extra Dictionary Tags

It may need to customise your PDF creation but you can add extra Dictionary tags. As a PDF developer I often see PDF files with non-standard tags added in by Creo or other tools. So you could include additional data on objects, such as image copyright or asset tag for it in your workflow.

Invisible Annotations on a page

If you want to include page specific data, you could include some invisible Annotations, which allow you to embed links and binary data and associate it with a specific page in the PDF file.

Custom tags in Structured Content

Structured content allows you to add your own metadata to the textual content. So the information could be tagged up to flag-up keywords, database field values, and so on.

Because the PDF file is such a flexible creature, it lends itself to alsorts of creative tricks to extend its functionality. Do you have any such favourite tricks to share?

This post is part of our “Understanding the PDF File Format” series. In each article, we discuss a PDF feature, bug, gotcha or tip. If you wish to learn more about PDF, we have 13 years worth of PDF knowledge and tips, so click here to visit our series index!

Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX.

He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.