We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get page size and orientation from PdfLoadedDocument

How to get Page size and orientation from PdfLoadedDocument

 

You can get the page size from the existing document using the “Size” property available in PdfLoadedPage class,

The below code snippet shows to get the page size from the PDF page.

[C#]

 

//Loading the Pdf document

PdfLoadedDocument lDoc = new PdfLoadedDocument("../../Data/Barcode.pdf");

 

//Getting the page size

SizeF size = lDoc.Pages[0].Size;

 

Currently we don’t have any property to get document orientation. As a workaround to get the solution, please refer the code snippet below.

[C#]

 

//Getting Document Orientation

PdfPageOrientation orientation;

if(size.Width>size.Height)

{

orientation= PdfPageOrientation.Landscape;

MessageBox.Show("Document Orientation is Landscape");

}

else if(size.Width<size.Height)

{

orientation = PdfPageOrientation.Portrait;

MessageBox.Show("Document Orientation is Potrait");

}

 

 

Sample:

The runnable in the below link shows how to get the page size and orientation of the document.

http://www.syncfusion.com/downloads/support/directtrac/general/PageSizeissue1064492684.zip

 

Article ID: Published Date: Last Revised Date: Platform: Control:
2638 11/13/2014 11/13/2014 WinForms PDF
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon