Skip to content

modern-pdf-lib


modern-pdf-lib / embedPageAsFormXObject

Function: embedPageAsFormXObject()

embedPageAsFormXObject(page, sourceRegistry, targetRegistry, xObjectName, options?): EmbeddedPdfPage

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

Embed a single page as a Form XObject in the target registry.

The page's content stream(s) are decoded and concatenated. The page's resources are deep-cloned into the target registry. The result is a PdfStream of Subtype /Form registered in the target.

Parameters

page

PdfPage

The source PdfPage to embed.

sourceRegistry

PdfObjectRegistry

The source document's object registry.

targetRegistry

PdfObjectRegistry

The target document's object registry.

xObjectName

string

The resource name to assign (e.g. 'XF1').

options?

EmbedPageOptions

Returns

EmbeddedPdfPage

An EmbeddedPdfPage handle.

Released under the MIT License.