/ PDF / PdfMeasurementUnit
Search results

PdfMeasurementUnit API in JavaScript PDF API control

Public Enum to define measurement unit of line measurement annotation.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access first page
let page: PdfPage = document.getPage(0);
// Access the annotation at index 0
let annotation: PdfLineAnnotation = page.annotations.at(0) PdfLineAnnotation;
// Sets the measurement unit of line measurement annoation as centimeter
annotation.unit = PdfMeasurementUnit.centimeter;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • centimeter - Specifies the type of centimeter.
  • inch - Specifies the type of inch.
  • millimeter - Specifies the type of millimeter.
  • pica - Specifies the type of pica.
  • point - Specifies the type of point.