Skip to main content

PointsToCentimeters

Converts points to centimeters.

Syntax

expression.PointsToCentimeters(pt);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
ptRequirednumberThe number of points to convert to centimeters.

Returns

number

Example

Convert points to centimeters in a PDF document.

// How do I convert points to centimeters in a PDF document?

// Convert points to centimeters and display the result in a PDF document.

const points = 1000;
const centimeters = Api.PointsToCentimeters(points);

const rgb = Api.RGB(50, 150, 250);
const fill = Api.CreateSolidFill(rgb);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape('rect', 150 * 36000, 150 * 36000, fill, stroke);
const paragraph = shape.GetContent().GetElement(0);
paragraph.AddText(points + ' points are equal to ' + centimeters + ' centimeters.');

const doc = Api.GetDocument();
const page = doc.GetPage(0);
page.AddObject(shape);