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

Free Support Forum - aspose.com

How to find the page Orientation in document

Hi Team,

I need the page orientation for each page. how to find it.

Thanks in advance.

@Mahesh39 Page orientation is set per section in MS Word document. You can check whether section has landscape orientation using PageSetup.getOrientation property. For example see the following code:

for(Section s : doc.getSections())
    System.out.println(s.getPageSetup().getOrientation() == Orientation.LANDSCAPE);

If you need to check whether some particular node is in section with landscape orientation, you can use code like this:

Section parentSection = (Section)node.getAncestor(NodeType.SECTION);
System.out.println(parentSection.getPageSetup().getOrientation() == Orientation.LANDSC

Also, please see our documentation to learn more about Aspose.Words Document Object Model