ConvertToPoints

Measurement and coordinate units

Description

Converts a value expressed in the given measurement unit to points and returns it, applying the scale where 72 points equal 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 to points, muMillimeters uses a factor of 72/25.4, muInches uses 72 and muTwips uses 1/20. Value is the length in that unit; any finite Double is accepted, including zero and negative values.

Return values

The same length expressed in points, computed as Value multiplied by the unit's points-per-unit factor. The function is pure arithmetic and has no failure path, so a result of 0 only means that Value was 0; no document has to be open and no state is read.

Remarks

One inch is 72 points, 25.4 millimetres or 1440 twips, so a millimetre is about 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.