Skip to content

modern-pdf-lib


modern-pdf-lib / EmbeddedPdfPage

Interface: EmbeddedPdfPage

Defined in: src/core/pdfEmbed.ts:43

Handle for a page that has been embedded as a Form XObject.

Returned by PdfDocument.embedPdf() and PdfDocument.embedPage(). Pass it to PdfPage.drawPage() to paint the embedded page.

Properties

height

readonly height: number

Defined in: src/core/pdfEmbed.ts:51

Original page height in points.


name

readonly name: string

Defined in: src/core/pdfEmbed.ts:45

XObject resource name (e.g. 'XF1').


ref

readonly ref: PdfRef

Defined in: src/core/pdfEmbed.ts:47

Indirect reference to the Form XObject in the target registry.


width

readonly width: number

Defined in: src/core/pdfEmbed.ts:49

Original page width in points.

Methods

scale()

scale(factor): object

Defined in: src/core/pdfEmbed.ts:58

Return the dimensions after applying a uniform scale factor.

Parameters

factor

number

Scale factor (e.g. 0.5 for half size).

Returns

object

height

height: number

width

width: number


scaleToFit()

scaleToFit(maxW, maxH): object

Defined in: src/core/pdfEmbed.ts:67

Compute dimensions that fit within the given maximum size while preserving the original aspect ratio.

Parameters

maxW

number

Maximum width.

maxH

number

Maximum height.

Returns

object

height

height: number

width

width: number

Released under the MIT License.