Free Support Forum - aspose.com

Page Orientation

Hi,


When converting from HTML to PDF, how can we set the page orientation we want in the output PDF?

Thanks,
Nitesh

Hi Nitesh,


Thanks for your inquiry. Please use the PageSetup.Orientation property to set the orientation of the page as shown in following code snippet.

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:#2B91AF;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> doc = new Document(MyDir

  • “in.html”);<o:p></o:p>

doc.FirstSection.PageSetup.Orientation = Aspose.Words.Orientation.Landscape;

doc.Save(MyDir + "out.pdf");


Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.