Free Support Forum - aspose.com

Word Document Page Setup options

Hi Support Team,

I need to get Paper size in inch programatically using ASPOSE word. Please refer attached screen.

I am interested only in getting width in inch format. Please reply asap.

Thanks

Hi Divesh,


Thanks for your inquiry. The PageSetup class represents the page setup properties of a section. PageSetup object contains all the page setup attributes of a section (left margin, bottom margin, paper size, and so on) as properties. You can get the Paper size by PageSetup.PaperSize property. Please read the list of paper sizes from here:
http://www.aspose.com/docs/display/wordsnet/PaperSize+Enumeration

The PageSetup.PageWidth returns the width of the page in points. Please use the following code snippet to achieve your requirements.

<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.docx”);<o:p></o:p>

DocumentBuilder builder = new DocumentBuilder();

PageSetup ps = builder.PageSetup;

Console.Write(ps.PaperSize.ToString());

Console.Write(ConvertUtil.PointToInch(ps.PageWidth).ToString());


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