Watermarks and Annotations in a PDF
A digital watermark is any auxiliary data embedded into a document used for subsequent identification. Watermarks may provide contextual support to an author's content, but are otherwise independent of that content. For example, stamping a page as "DRAFT" or "CONFIDENTIAL" imparts meaning beyond any text or drawings present on that page.
PDF documents may express a digital watermark using any of the following techniques:
- Annotations: An interactive object associated with a location on the page that displays text or an image. A variety of types may be used including Text, Free text, Rubber stamp. Watermark annotations may be used to print at a fixed position and size on a page, regardless of the dimensions of the printed page.
- Page Graphics: Graphics may include text with specific style information and color, vector line art, sampled images, or shading patterns. Content representing a watermark are inserted directly into the page's content stream, possibly indistinguishable from the original content. Graphics specifically intended for watermarks may be indicated using Optional Content Groups.
- Optional Content Groups (OCG): Collections of graphics in a PDF document can be selectively drawn or hidden by document authors or consumers. An OCG can indicate its graphics are intended as a watermark for printing.
- Pagination Artifacts: Tagged PDF documents distinguish between original content and artifacts of the layout process, including pagination artifacts such as header, footers, page numbers. Content may be specifically designated to be a watermark.
Each of these techniques can be accomplished using ImageGear, with varying complexity and completeness. See the following subsections:
Annotations
Annotations are added to PDF pages by using the ImageGear ART or ArtX Components, which support a subset of available PDF annotations. Refer to PDF Marks for the mapping used with PDF annotations.
ImageGear does not export ART Marks to PDF Watermark annotations. Applications that require explicit PDF Watermark annotation support may use the basic object methods to create a PDF Watermark annotation object and appearance streams, as outlined in the PDF Reference under topic "Watermark Annotations". However, ImageGear ART can convert ART marks to PDF annotations and PDF annotations to ART marks. Please see PDF Marks for more information.
The following code snippet demonstrates adding a Text ART mark and exporting to all of the pages in a PDF document as a FreeText annotation:
Page Graphics
Watermarks expressed as PDF page graphics are added using ImageGear’s PDF page objects and elements methods. These methods provide for editing the content of graphics objects and operators described in the PDF Reference.
The following snippet demonstrates creating a 24-bpp RGB PDEImage from an ImageGear image and setting it up to be placed at the bottom left corner of a PDF page:
Adjustments are required to successfully add images utilizing alpha channels, other pixel formats and color spaces in accordance to the image XObject discussion in the PDF Reference. The AddWatermarksToPDF Sample demonstrates some of these adjustments.
The following code snippet calls the CreatePDEImageFromImageGear method from above and places the PDE image created into the content of the PDF page.
Refer to the AddWatermarksToPDF Sample.
See the PDF Reference topic “Page Editing Objects and Elements” for additional information.
Optional Content Groups
Watermark optional content can be added to PDF pages using ImageGear’s PDF page objects and elements methods. These methods provide for editing the content of graphics objects and operators described in the PDF Reference, which provides methods for layer management.
To designate a watermark intended for printing, add an Optional Content Print Usage dictionary with Subtype name "Watermark" to that OCG, represented with a PDF layer:
See the PDF Reference topic "Making Graphical Content Optional" for additional information.
Pagination Artifacts
Watermarks expressed as Pagination Artifacts can be added using the ImageGear’s PDF page objects and elements methods, which provides methods to create a marked-content sequence in accordance with the PDF Reference.
See the PDF Reference topic "Real Content and Artifacts" for additional information