BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

GetPageSize Method

Gets page width and height information from a PDF file.

Warning: This method does not work for Java and scripting languages, such as VBScript and classic ASP. For those languages please use the GetPageSizeVar() method instead.

Sub GetPageSize(Page As Long,
                Width As Double,
                Height As Double)

void GetPageSize(int Page,
                 out double Width,
                 out double Height)

PageSize GetPageSize(int Page) throws PDFProcessorException

Where PageSize is a utility class:

public class PageSize
{
   public double width;
   public double height;
}

Parameters

Return Values

N/A.

Remarks

Coordinate system information:

  1. The unit size of PDF user space is 1/72 inch (1 inch = 72 PDF user space unit).
  2. The location of the origin (0, 0) is at top-left corner.
    The page number uses zero-based index, meaning that page number starts from 0.

Example Usage in VB.NET

Dim width, height As Double
Dim oProcessor As PDFProcessor = New PDFProcessor
Dim oProcessorHandle As PDFProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\input.pdf")

   oProcessorHandle.GetPageSize(0, _
                                width, _
                                height)
                                                                
oProcessorHandle.Close()
MessageBox.Show("Width: " + width.ToString() + ", Height: " + height.ToString())

Example Usage in C#

double width, height;
PDFProcessor oProcessor = new PDFProcessor();
PDFProcessorHandle oProcessorHandle = oProcessor.OpenFile(@"C:\test\input.pdf", @"C:\test\input.pdf", null);

   oProcessorHandle.GetPageSize(0, 
                                out width, 
                                out height);
                                                                
oProcessorHandle.Close();
MessageBox.Show("Width: " + width.ToString() + ", Height: " + height.ToString());