Before working with a PDF document, make sure to initialize the PDF component (see Getting Started with PDF).
Refer to the AddNewPageWithImage Sample and the AddWatermarksToPDF Sample for complete sample code that illustrates how to use these capabilities.
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:
Each of these techniques can be accomplished using ImageGear, with varying complexity and completeness. See the following subsections:
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:
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.
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.
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