Skip to Content

How to embed information in an existing PDF document and keep it private?

Estimated Reading Time: 1 Minutes

The recommended approach is to add information to a page-piece dictionary, which is specifically designed to hold private data. The data may be associated with a page or XObject via an optional PieceInfo entry or with the document itself by means of a PieceInfo entry in the document catalog. For example, Adobe Illustrator uses content stored in a PieceInfo entry that only Illustrator can read. To learn more, see Section 14.5, “Page-Piece Dictionaries,” in the ISO 32000 Reference.

It's also possible to add information like this to the Comments within the PDF, although this is not recommended. The percent sign, outside of a string or stream, is the comment indicator in PDF, just as it is with PostScript. Please note that except for the two entries below:

%PDF?1.x
%%EOF

PDF comments have no syntax. So one can format comments in a PDF document however they like; the PDF format offers no equivalent of the PostScript Document Structuring Conventions (DSC). Keep in mind, however, that applications that edit PDF documents do not necessarily preserve comments added to a PDF document. When the PDF document is saved again, the comments may be removed.

It is also possible to store information in unused keys of a dictionary object. One can embed a value or stream into a dictionary object but not make use of the object in the PDF. Adobe Acrobat or Reader or other conforming viewing tools will ignore the unused dictionary object. If, however, an application reads the PDF and saves it to a new file, the unused dictionary entry could be removed.

How to embed information in an existing PDF document and keep it private?
  • COMMENT