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

Free Support Forum - aspose.com

Landscape property returns wrong value


I’m still evaluating Aspose.PDF and got a problem with the landscape property. The added document has 4 pages, all of them are in landscape format. The document is shown correctly in Adobe. Aspose does not recognize those pages as landscape.
The following code loads the documents and gets the landscape info of every page. It prints False for every page.

Dim pdf As Document = New Document(path)
For Each p As Page In pdf.Pages

Am I doing something wrong? Do I have to set some other Properties while loading the document?

Hi Aline,

Thanks for your inquiry. Please note IsLandscape property is used while creating new PDF document for existing PDF document you need to check page Width and Height for page orientation as following. It will help you to accomplish the task.

Dim doc As New Aspose.Pdf.Document(“Hochrechnung.pdf”)<o:p></o:p>

For Each page As Aspose.Pdf.Page In doc.Pages

If rect.Width > rect.Height Then

Console.WriteLine("Page no{0}: Landscape", page.Number)


Console.WriteLine("Page no{0}: Portrait", page.Number)

End If


Please feel free to contact us for any further assistance.

Best Regards,