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.

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

Sub GetPageSize(Page As Integer, ByRef Width As Double, ByRef Height As Double)

def GetPageSize(self, Page) # returns PageSize

class PageSize:
   def __init__(self, width, height):
      self.width = width
      self.height = height
PageSize GetPageSize(int Page) throws PDFProcessorException

public class PageSize {
   public double width;
   public double height;
function GetPageSize($Page, &$Width, &$Height) 

BclPrcResult GetPageSize(BclPDFProcessorHandle* pHandle,
                         int Page,
                         double* poutWidth,
                         double* poutHeight);

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


Return Values



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, _
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);

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