Extent
Extent:
Represents the dimensions (width and height) of a document element.
Remarks
Section titled “Remarks”Extent specifies the size of elements like images in the document. Dimensions are
measured in points (1 point = 1/72 inch).
Examples
Section titled “Examples”Get image dimensions:
const inlines = textView.inlines();for (const rangeInline of inlines) { if (rangeInline.inline.type === 'image') { const extent = rangeInline.inline.extent(); console.log(`Image size: ${extent.width} x ${extent.height}`); }}Scale image proportionally:
const inlines = textView.inlines();for (const rangeInline of inlines) { if (rangeInline.inline.type === 'image') { const current = rangeInline.inline.extent(); const scale = 0.5; // Scale to 50%
rangeInline.inline.setExtent({ width: current.width * scale, height: current.height * scale }); }}Properties
Section titled “Properties”width:
number
The width of the element.
Remarks
Section titled “Remarks”Width dimension. Measured in points (1 point = 1/72 inch).
height
Section titled “height”height:
number
The height of the element.
Remarks
Section titled “Remarks”Height dimension. Measured in points (1 point = 1/72 inch).