Convert Between Measurement Units

Contents
[ ]

Most of the object properties provided in the Aspose.Words API that represent some measurement, such as width or height, margins, and various distances, accept values in points, where 1 inch equals 72 points. Sometimes this is not convenient and points need to be converted to other units.

Aspose.Words provides the ConvertUtil class that provides helper functions to convert between various measurement units. It enables to convert:

  • inches, pixels, and millimeters to points
  • points to inches and pixels
  • pixels from one resolution to another

Converting pixels to points and vice versa can be performed at 96 dpi (dots per inch) resolutions or specified dpi resolution.

The ConvertUtil class is especially useful when setting various page properties because, for instance, inches are more common measurement units than points.

The following code example shows how to specify page properties in inches: