We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Check orientation of a (scanned) pdf document


we are processing scanned documents of our customers. Is there a way to check if the orientation of the document is correctly or if it must be rotated?

If this is not possible with Aspose.Pdf can we achive this with Aspose.Ocr?


Hi Wolfgang,

Thanks for contacting support.

In order to check the orientation of input PDF file, please try using the following code snippet.


// load the source PDF file<o:p></o:p>

Aspose.Pdf.Document sourcefile= new Aspose.Pdf.Document("input.pdf");

// determine if source PDF is Landscape

Landscape = "
+ sourcefile.PageInfo.IsLandscape);

In case you encounter any issue, please feel free to contact.


thank for your answer. The problem I wanted to describe was not landscape or not, but if a user scans upside down and the page must be rotated by 180°.

That is what we want to automate in our service.


Hi Wolfgang,

Thanks for sharing the details.

I am afraid Aspose.Pdf for .NET cannot determine the orientation of image present inside the PDF file. As the contents inside the PDF will appear as Image, so I am afraid it’s difficult to determine the upper or lower end of the image.

However as a workaround, you may consider extracting the image from PDF file, perform OCR over the Image and search for particular text string (may be page Header/Footer) and the text coordinates may help in determining the orientation of image inside the PDF. For further details, please visit