Skip to main content
A newer version of this page is available. .

Adding Graphics Content to a Page

  • 2 minutes to read

When adding graphics content to an entire page or a part of it, the world coordinates are converted to page coordinates (see Coordinate Systems to learn more).

The sections below describe methods used to add graphics content to a page.

Adding graphics content to an existing page

To add graphics content to a foreground/background of a page, call the overloaded PdfGraphics.AddToPageForeground or PdfGraphics.AddToPageBackground method and pass a PdfPage object containing the page where graphics should be drawn, and dpiX and dpiY values as arguments. Use the PdfDocument.Pages property to access a collection of pages within a document, and the PdfDocumentProcessor.Document property to get a document.

Adding graphics content to a new page

To render a new page with graphics content, call the overloaded PdfDocumentProcessor.RenderNewPage method and pass graphics content (represented by a PdfGraphics object), a PdfRectangle object containing the page size, and dpiX and dpiY values as arguments.

Note

The dpiX and dpiY values are equal to 96 in all overloaded PdfDocumentProcessor.RenderNewPage, PdfGraphics.AddToPageForeground, PdfGraphics.AddToPageBackground methods. To render graphics content on a page at another dpi, pass dpiX and dpiY values to one of these overloaded methods.

A page’s foreground content (text, an image) can overlap a watermark added to a page’s background using the PdfGraphics.AddToPageBackground method. We recommend placing a semi-transparent watermark on the page’s foreground (instead of the page’s background) by calling the PdfGraphics.AddToPageForeground method.

See Also