Most of the object properties provided in the Aspose.Words API that represent some measurement (width/height, margins and various distances) accept values in points (1 inch equals 72 points). Sometimes this is not convenient so there is the ConvertUtil class that provides helper functions to convert between various measurement units. It allows converting inches to points, points to inches, pixels to points, and points to pixels. When pixels are converted to points and vice versa, it can be performed at 96 dpi (dots per inch) resolution or at the specified dpi resolution.
ConvertUtil is very useful when setting different page properties because for instance inches are more usual measurement units than points. The following example demonstrates how to set up the page properties in inches.
Example
Shows how to specify page properties in inches.
[Java]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
PageSetup pageSetup = builder.getPageSetup();
pageSetup.setTopMargin(ConvertUtil.inchToPoint(1.0));
pageSetup.setBottomMargin(ConvertUtil.inchToPoint(1.0));
pageSetup.setLeftMargin(ConvertUtil.inchToPoint(1.5));
pageSetup.setRightMargin(ConvertUtil.inchToPoint(1.5));
pageSetup.setHeaderDistance(ConvertUtil.inchToPoint(0.2));
pageSetup.setFooterDistance(ConvertUtil.inchToPoint(0.2));