PdfGraphics.AddToPageForeground(PdfPage, Single, Single) Method
Adds graphics to a PDF page foreground with the specified horizontal and vertical resolutions.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v24.2.Drawing.dll
NuGet Package: DevExpress.Pdf.Drawing
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
page | Pdf |
A Pdf |
dpi |
Single | A Single object that represents the value, in dots per inch, for the horizontal resolution. |
dpi |
Single | A Single object that represents the value, in dots per inch, for the vertical resolution. |
#Remarks
Call the AddToPageForeground method to draw graphics as the foreground of the page. To draw graphics as the background of the page content, call the PdfGraphics.AddToPageBackground method.
The overloaded AddToPageForeground method automatically converts world coordinates to page coordinates. See Coordinate Systems to learn more.
The world coordinates (units) are converted to page coordinates (points) using the following formula:
x = (unitX / dpiX) * 72;
y = cropBoxHeight - (unitY / dpiY) * 72.
To render graphics on a PDF document page, pass 72 as a DPI value to this method. The DPI value you pass into this method does not affect graphics quality and is used for coordinates transformation only (world coordinates to page coordinates). For example, the 72 DPI value allows you to transform coordinates without any scaling.
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the AddToPageForeground(PdfPage, Single, Single) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.