PDF Xpress for .NET - User Guide > How To > Get Page Information |
PDF Xpress™ recovers PDF per-page characteristics that describe how that page should be presented on display or printer devices.
Refer to topic PDF Coordinate Systems for additional information.
The following example shows how to recover the physical dimensions of a PDF page, expressed in inches:
C# Example |
Copy Code
|
---|---|
public String GetPageSizeInInches( Document doc, Int32 pageIndex ) { PageInfo pageInfo = doc.GetInfo(pageIndex); return String.Format( "Page {0} dimensions are {1}\"x{2}\"", new object[] { pageIndex, pageInfo.ClipWidth / 72.0, PageInfo.ClipHeight / 72.0 }); } |
The following example shows how to recover the PDF page CropBox, expressed in default user space units:
C# Example |
Copy Code
|
---|---|
public String GetCropBox( Document doc, Int32 pageIndex ) { PageInfo pageInfo = doc.GetInfo(pageIndex, PdfCoordinateSystem.RotatedCroppedUserSpace); return String.Format( "Page {0} CropBox is [ left={1:f4} bottom={2:f4} right={3:f4} top={4:f4} ]", new object[] { pageIndex, pageInfo.ClipX, pageInfo.ClipY, pageInfo.ClipX + pageInfo.ClipWidth, pageInfo.ClipY + pageInfo.ClipHeight }); } |
The following example shows how to recover the PDF page MediaBox, expressed in default user space units:
C# Example |
Copy Code
|
---|---|
public String GetMediaBox( Document doc, Int32 pageIndex ) { PageInfo pageInfo = doc.GetInfo(pageIndex, PdfCoordinateSystem.RotatedCroppedUserSpace); return String.Format( "Page {0} CropBox is [ left={1:f4} bottom={2:f4} right={3:f4} top={4:f4} ]", new object[] { pageIndex, pageInfo.MediaX, pageInfo.MediaY, pageInfo.MediaX + pageInfo.MediaWidth, pageInfo.MediaY + pageInfo.MediaHeight }); } |