Free Support Forum - aspose.com

How make first 5 pages as Portrait and rest of the pages make landscape?

How make first 5 pages as Portrait and rest of the pages make landscape ?

@hafizsohaibali123,

Thanks for your inquiry. You can change the orientation of page using PageSetup.Orientation property. Please note that PageSetup class represents the page setup properties of a section. In your case, we suggest you following solution.

  1. Please iterate over all paragraph of document.
  2. Get the page number of paragraph using LayoutCollector.GetStartPageIndex method.
  3. If the page number is 6, move the cursor to the first paragraph on 6th page.
  4. Insert the break of type section break.
  5. Change the orientation of page using Section.PageSetup.Orientation property.