All docs
V21.2
21.2
21.1
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+

PdfPage.Resize(PdfRectangle, PdfContentHorizontalAlignment, PdfContentVerticalAlignment) Method

Resizes the page content.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v21.2.Core.dll

Declaration

public void Resize(
    PdfRectangle mediaBox,
    PdfContentHorizontalAlignment horizontalAlignment,
    PdfContentVerticalAlignment verticalAlignment
)

Parameters

Name Type Description
mediaBox PdfRectangle

New page size.

horizontalAlignment PdfContentHorizontalAlignment

The content’s horizontal alignment.

verticalAlignment PdfContentVerticalAlignment

The content’s vertical alignment.

Remarks

When the page is resized, the page content retains its aspect ratio.

Note

PDF pages are measured in points. One point is 1/72nd of an inch (0.3528 mm). To convert this measurement unit to pixels, use the Units.PointsToPixelsF method.

Example

The code sample below shows how to resize a page:

resize page

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.LoadDocument(@"Document.pdf");
    PdfPage page = processor.Document.Pages[0];

    page.Resize(PdfPaperSize.Letter, PdfContentHorizontalAlignment.Center,
       PdfContentVerticalAlignment.Center);
    processor.SaveDocument("out2.pdf");
}
See Also