Skip to content
Document Authoring DA  API Docs v1.10.0
npmGitHub

Extent

Extent:

Represents the dimensions (width and height) of a document element.

Extent specifies the size of elements like images in the document. Dimensions are measured in points (1 point = 1/72 inch).

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
});
}
}

width: number

The width of the element.

Width dimension. Measured in points (1 point = 1/72 inch).


height: number

The height of the element.

Height dimension. Measured in points (1 point = 1/72 inch).