.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

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.v21.1.Drawing.dll


public void AddToPageForeground(
    PdfPage page,
    float dpiX,
    float dpiY


Name Type Description
page PdfPage

A PdfPage object that is the page in the document where graphics are drawn (measured in points - 1/72 of an inch).

dpiX Single

A Single object that represents the value, in dots per inch, for the horizontal resolution.

dpiY Single

A Single object that represents the value, in dots per inch, for the vertical resolution.


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, 72 DPI value allows transforming coordinates without any scaling.

See Also