PdfViewer.GetPageSize(Int32) Method
In This Article
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
#Parameters
Name | Type | Description |
---|---|---|
page |
Int32 | An integer value, specifying the document page index. |
#Returns
Type | Description |
---|---|
Size |
A Size |
#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