All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

PdfGraphics.DrawPageContent(PdfPage) Method

Draws the specified page's content.

Namespace: DevExpress.Pdf

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

Declaration

public void DrawPageContent(
    PdfPage source
)
Public Sub DrawPageContent(
    source As PdfPage
)

Parameters

Name Type Description
source PdfPage

The source page from which content is drawn.

Remarks

Use this method to add the page content to the document. Call the PdfGraphics.AddToPageForeground method to draw the resulting graphics in the document.

Call the PdfDocumentProcessor.FlattenForm() method to flatten interactive forms. Otherwise, interactive forms are ignored.

The code sample below shows how to insert page content from one document into another. The source content is scaled and added to the end of the target page.

result

using DevExpress.Pdf;
using System.Drawing;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.CreateEmptyDocument();
    PdfPage page = processor.AddNewPage(PdfPaperSize.A4);
    using (PdfDocumentProcessor processor2 = new PdfDocumentProcessor())
    {
        processor2.LoadDocument(@"Demo.pdf");
        using (PdfGraphics graphics = processor.CreateGraphics())
        {
            graphics.SaveGraphicsState();

            //Define the position to insert the content on a target page:
            graphics.TranslateTransform((float)(page.CropBox.Width * 1 / 3), (float)(page.CropBox.Height * 4 / 5));
            PdfRectangle clip = processor2.Document.Pages[0].CropBox;

            //Resize the source page content to fit the target page:
            graphics.ScaleTransform((float)(page.CropBox.Width / clip.Width / 3), (float)(page.CropBox.Width / clip.Width / 3));

            //Crop the source content to insert the third of the page:
            graphics.IntersectClip(new RectangleF((float)clip.Left, (float)(clip.Top / 2.8), (float)clip.Width, (float)(clip.Height / 2.8)));

            //Draw the cropped segment in the target page:
            graphics.DrawPageContent(processor2.Document.Pages[0]);
            graphics.RestoreGraphicsState();

            //Apply the changes:
            graphics.AddToPageForeground(page, 72, 72);
        }
    }
    processor.SaveDocument("out2.pdf");
}
See Also