ConvertToPoints
Measurement and coordinate units
Description
Converts a value expressed in the given measurement unit into points and returns it. The conversion applies the scale in which 72 points make one inch.
Syntax
Delphi
Function TPDFlib.ConvertToPoints(AUnit: TPDFlibMeasurementUnit; Value: Double): Double;
Parameters
AUnit is the unit Value is expressed in: muPixels and muPoints both map one-to-one onto points, muMillimeters applies a factor of 72/25.4, muInches applies 72 and muTwips applies 1/20. Value is the length in that unit; any finite Double is accepted, zero and negative values included.
Return values
The same length expressed in points, obtained by multiplying Value by the unit's points-per-unit factor. The function is pure arithmetic with no failure path, so a result of 0 only means that Value was 0; no document needs to be open and no state is read.
Remarks
One inch is 72 points, 25.4 millimetres or 1440 twips, so a millimetre is roughly 2.8346 points and a twip is 0.05 points. The factor is fixed and independent of the measurement unit currently set with SetMeasurementUnit, which lets a caller convert values recorded in physical units into points for any document. muPixels is deliberately identical to muPoints, assuming 72 pixels per inch. Results are not rounded; ConvertFromPoints performs the inverse step.