Skip to main content

PdfGraphics.AddLinkToPage(RectangleF, Int32) Method

Adds a link that refers to the document page with the specified number.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.2.Drawing.dll

NuGet Package: DevExpress.Pdf.Drawing


public void AddLinkToPage(
    RectangleF linkArea,
    int pageNumber


Name Type Description
linkArea RectangleF

A page area (in world coordinate system) where you can add a link.

pageNumber Int32

The page number.


This method specifies the page area on which you can click to refer to the document page defined by the pageNumber parameter.

To draw a link on the PDF page, use one of the following methods:

PdfGraphics.AddToPageForeground, PdfGraphics.AddToPageBackground
These methods allow you to draw content on an existing page.
Draws content on a new page.


Coordinate system transformations (e.g., system rotation) are not taken into account when the AddLinkToPage method is called.

The code sample below adds a link to the second document page.

View Example

using System;
using DevExpress.Pdf;
using System.Drawing;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
    // Create an empty document.

    // Create and draw graphics.
    using (PdfGraphics graphics = processor.CreateGraphics())
        // Draw a link text.
        SolidBrush black = (SolidBrush)Brushes.Black;
        using (Font font = new Font("Times New Roman", 32, FontStyle.Bold))
            graphics.DrawString("PDF Document API", font, black, 180, 150);

        // Create a link to the second document page.
        graphics.AddLinkToPage(new RectangleF(180, 160, 480, 30), 2);

        // Render a page with graphics.
        processor.RenderNewPage(PdfPaperSize.Letter, graphics);

        // Create the second document page to which the link refers.
See Also