[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Expand]Spreadsheet Document API
 [Expand]Word Processing Document API
 [Collapse]PDF Document API
   Getting Started
   Coordinate Systems
   Document Generation
  [Collapse]PDF Graphics
    Overview
    Creating PDF Graphics Context
    Drawing into Graphics Context
    Adding Graphics Content to a Page
    Adding Interactive Form Fields
  [Expand]Document Manipulation
  [Expand]Additional Content
  [Expand]Interactive Forms
  [Expand]Text Markup Annotations
  [Expand]Document Security
  [Expand]Examples
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Adding Graphics Content to a Page

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.

Expanded 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.

Expanded 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.

Expanded See Also

Is this topic helpful?​​​​​​​