Skip to main content

PdfViewer.GetPageSize(Int32) Method

Returns the size (in inches) of the specified document page.

Namespace: DevExpress.XtraPdfViewer

Assembly: DevExpress.XtraPdfViewer.v23.2.dll

NuGet Package: DevExpress.Win.PdfViewer

Declaration

public SizeF GetPageSize(
    int pageNumber
)

Parameters

Name Type Description
pageNumber Int32

An integer value, specifying the document page index.

Returns

Type Description
SizeF

A SizeF structure, specifying the page width and height in inches.

Remarks

The code sample below calculates the zoom factor depending on the page height. The dpi variable is a default resolution value for a PDF Viewer.

SizeF currentPageSize = pdfViewer1.GetPageSize(pdfViewer1.CurrentPageNumber);
float dpi = 110f;
float pageHeightPixel = currentPageSize.Height * dpi;
float topBottomOffset = 40f;
pdfViewer1.ZoomFactor = ((float)pdfViewer1.ClientSize.Height - topBottomOffset) / pageHeightPixel * 100f;
See Also