ConvertUtilPointToPixel Method (Double, Double) |
Converts points to pixels at the specified pixel resolution.
Namespace:
Aspose.Words
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic static double PointToPixel(
double points,
double resolution
)
Public Shared Function PointToPixel (
points As Double,
resolution As Double
) As Double
public:
static double PointToPixel(
double points,
double resolution
)
static member PointToPixel :
points : float *
resolution : float -> float
Parameters
- points
- Type: SystemDouble
The value to convert. - resolution
- Type: SystemDouble
The dpi (dots per inch) resolution.
Return Value
Type:
Double
Remarks
1 inch equals 72 points.
ExamplesShows how to use convert points to pixels with default and custom resolution.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
PageSetup pageSetup = builder.PageSetup;
pageSetup.TopMargin = ConvertUtil.PixelToPoint(2.0);
double myDpi = 192.0;
Console.WriteLine("The size of my top margin is {0} points, or {1} pixels with default resolution.",
pageSetup.TopMargin, ConvertUtil.PointToPixel(pageSetup.TopMargin));
Console.WriteLine("The size of my top margin is {0} points, or {1} pixels with custom resolution.",
pageSetup.TopMargin, ConvertUtil.PointToPixel(pageSetup.TopMargin, myDpi));
See Also