PDF Xpress for ActiveX - 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:
VB Example |
Copy Code
|
---|---|
'This function returns a string describing the PDF page size in inches. Public Function GetPageSizeInInches( _ ByVal objPdf As PdfDocument, ByVal pageIndex As Long) As String Dim objPageInfo As PageInfo objPageInfo = objPdf.GetInfo(pageIndex) GetPageSizeInInches = "Page " & CLng(pageNumber + 1) & " dimensions are " _ & objPageInfo.ClipWidth / 72# & " inches x" _ & objPageInfo.ClipHeight / 72# & " inches" End Function |
The following example shows how to recover the PDF page CropBox, expressed in default user space units:
VB Example |
Copy Code
|
---|---|
'This function returns a string describing the PDF crop box in default user space units. Public Function GetCropBox( _ ByVal objPdf As PdfDocument, ByVal pageIndex As Long) As String Dim objPageInfo As PageInfo objPageInfo = objPdf.GetInfo(pageIndex, PDF_CoordinateSystem_DefaultUserSpace) GetCropBox = "Page " & CLng(pageNumber + 1) & " CropBox is [ " _ & "Left=" & objPageInfo.ClipX & ", " _ & "Bottom=" & objPageInfo.ClipY & ", " _ & "Right=" & objPageInfo.ClipX + objPageInfo.ClipWidth & ", " _ & "Top=" & objPageInfo.ClipY + objPageInfo.ClipHeight & " ]" End Function |
The following example shows how to recover the PDF page MediaBox, expressed in default user space units:
VB Example |
Copy Code
|
---|---|
'This function returns a string describing the PDF crop box in default user space units. Public Function GetCropBox( _ ByVal objPdf As PdfDocument, ByVal pageIndex As Long) As String Dim objPageInfo As PageInfo objPageInfo = objPdf.GetInfo(pageIndex, PDF_CoordinateSystem_DefaultUserSpace) GetMediaBox = "Page " & CLng(pageNumber + 1) & " MediaBox is [ " _ & "Left=" & objPageInfo.MediaX & ", " _ & "Bottom=" & objPageInfo.MediaY & ", " _ & "Right=" & objPageInfo.MediaX + objPageInfo.MediaWidth & ", " _ & "Top=" & objPageInfo.MediaY + objPageInfo.MediaHeight & " ]" End Function |