Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfViewer.GetPageSize(Int32) Method

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

Namespace: DevExpress.XtraPdfViewer

Assembly: DevExpress.XtraPdfViewer.v24.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