Skip to content

zeropdf v1.3.0


zeropdf / PdfStructureContainer

Class: PdfStructureContainer

Defined in: src/document.ts:604

A builder for grouping tagged PDF content under a shared structure element. It can add text, blocks, lists, tables, images, and nested sections to the same semantic container.

Constructors

Constructor

ts
new PdfStructureContainer(
   page, 
   embeddedFonts, 
   node, 
   fontFamilies?, 
   textDefaults?): PdfStructureContainer;

Defined in: src/document.ts:614

Creates a structure container bound to a page, embedded fonts, and parent structure node.

Parameters

ParameterTypeDescription
pageInternalPageModelThe internal page model to write into.
embeddedFontsReadonlyMap<string, ParsedTrueTypeFont>The embedded font registry used for text layout.
nodeInternalStructureNodeThe parent structure node for tagged content.
fontFamiliesReadonlyMap<string, FontFamilyFaces>Font families registered with the document.
textDefaults?TextDefaultsDocument-wide text defaults.

Returns

PdfStructureContainer

Methods

bmp()

ts
bmp(data, options): this;

Defined in: src/document.ts:730

Adds a tagged BMP image to this structure container.

Parameters

ParameterTypeDescription
dataBinaryDataThe binary image or font data.
optionsBmpImageOptionsOptions that control the operation.

Returns

this


circle()

ts
circle(
   cx, 
   cy, 
   radius, 
   style?): this;

Defined in: src/document.ts:844

Draws a circle. See PdfPage.circle.

Parameters

ParameterType
cxnumber
cynumber
radiusnumber
style?ShapeStyle

Returns

this


container()

Creates a nested tagged structure container.

Param

The structure tag to create.

Param

Either structure options or a build callback.

Param

An optional build callback when options are provided separately.

Call Signature

ts
container(tag, build?): PdfStructureContainer;

Defined in: src/document.ts:872

Creates a nested tagged structure container.

Parameters
ParameterTypeDescription
tagPdfContainerTagThe structure tag to create.
build?(container) => voidAn optional callback that receives the created container.
Returns

PdfStructureContainer

The created structure container.

Call Signature

ts
container(
   tag, 
   options?, 
   build?): PdfStructureContainer;

Defined in: src/document.ts:885

Creates a nested tagged structure container.

Parameters
ParameterTypeDescription
tagPdfContainerTagThe structure tag to create.
options?PdfStructureOptionsOptions that control the operation.
build?(container) => voidAn optional callback that receives the created container.
Returns

PdfStructureContainer

The created structure container.


ellipse()

ts
ellipse(
   cx, 
   cy, 
   rx, 
   ry, 
   style?): this;

Defined in: src/document.ts:851

Draws an ellipse. See PdfPage.ellipse.

Parameters

ParameterType
cxnumber
cynumber
rxnumber
rynumber
style?ShapeStyle

Returns

this


flow()

ts
flow(options?): PdfFlow;

Defined in: src/document.ts:999

Creates a flow helper that writes into this structure container.

Parameters

ParameterTypeDescription
optionsFlowOptionsOptions that control the operation.

Returns

PdfFlow

The created flow helper.


gif()

ts
gif(data, options): this;

Defined in: src/document.ts:785

Adds a tagged GIF image to this structure container.

Parameters

ParameterTypeDescription
dataBinaryDataThe binary image or font data.
optionsGifImageOptionsOptions that control the operation.

Returns

this


image()

ts
image(data, options): this;

Defined in: src/document.ts:819

Adds a raster image (auto-detecting the format) tagged under this container.

Parameters

ParameterTypeDescription
dataBinaryDataThe image bytes.
optionsJpegImageOptionsPlacement and tagging options.

Returns

this


jbig2()

ts
jbig2(data, options): this;

Defined in: src/document.ts:741

Adds a tagged JBIG2 image to this structure container.

Parameters

ParameterTypeDescription
dataBinaryDataThe binary image or font data.
optionsJbig2ImageOptionsOptions that control the operation.

Returns

this


jp2()

ts
jp2(data, options): this;

Defined in: src/document.ts:763

Adds a tagged JPEG 2000 image to this structure container.

Parameters

ParameterTypeDescription
dataBinaryDataThe binary image or font data.
optionsJp2ImageOptionsOptions that control the operation.

Returns

this


jpeg()

ts
jpeg(data, options): this;

Defined in: src/document.ts:708

Adds a tagged JPEG image to this structure container.

Parameters

ParameterTypeDescription
dataBinaryDataThe binary image or font data.
optionsJpegImageOptionsOptions that control the operation.

Returns

this


line()

ts
line(
   x1, 
   y1, 
   x2, 
   y2, 
   style?): this;

Defined in: src/document.ts:834

Draws a straight line between two points. See PdfPage.line.

Parameters

ParameterType
x1number
y1number
x2number
y2number
style?ShapeStyle

Returns

this


ts
link(url, options): this;

Defined in: src/document.ts:808

Adds a tagged URI link annotation to this structure container.

Parameters

ParameterTypeDescription
urlstringThe URI target.
optionsUriLinkOptionsOptions that control the operation.

Returns

this


list()

ts
list(items, options): this;

Defined in: src/document.ts:664

Adds a tagged list to this structure container.

Parameters

ParameterTypeDescription
itemsreadonly ListItem[]The list items to add.
optionsListOptionsOptions that control the operation.

Returns

this


path()

ts
path(commands, style): this;

Defined in: src/document.ts:858

Adds vector path commands. Mirrors PdfPage.path.

Parameters

ParameterType
commandsPathCommand[]
stylePathStyle

Returns

this


png()

ts
png(data, options): this;

Defined in: src/document.ts:719

Adds a tagged PNG image to this structure container.

Parameters

ParameterTypeDescription
dataBinaryDataThe binary image or font data.
optionsPngImageOptionsOptions that control the operation.

Returns

this


rect()

ts
rect(
   x, 
   y, 
   width, 
   height, 
   style?): this;

Defined in: src/document.ts:827

Draws a rectangle. See PdfPage.rect.

Parameters

ParameterType
xnumber
ynumber
widthnumber
heightnumber
style?ShapeStyle

Returns

this


structure()

Creates a nested tagged structure container.

Param

The replacement structure role.

Param

Either structure options or a build callback.

Param

An optional build callback when options are provided separately.

Call Signature

ts
structure(role, build?): PdfStructureContainer;

Defined in: src/document.ts:936

Creates a nested tagged structure container.

Parameters
ParameterTypeDescription
role| string & object | PdfStandardStructureTagThe replacement structure role.
build?(container) => voidAn optional callback that receives the created container.
Returns

PdfStructureContainer

The created structure container.

Call Signature

ts
structure(
   role, 
   options?, 
   build?): PdfStructureContainer;

Defined in: src/document.ts:949

Creates a nested tagged structure container.

Parameters
ParameterTypeDescription
role| string & object | PdfStandardStructureTagThe replacement structure role.
options?PdfStructureOptionsOptions that control the operation.
build?(container) => voidAn optional callback that receives the created container.
Returns

PdfStructureContainer

The created structure container.


svg()

ts
svg(data, options): this;

Defined in: src/document.ts:796

Adds a tagged SVG graphic to this structure container.

Parameters

ParameterTypeDescription
datastring | BinaryDataThe SVG text data.
optionsSvgImageOptionsOptions that control the operation.

Returns

this


table()

ts
table(rows, options): this;

Defined in: src/document.ts:684

Adds a tagged table to this structure container.

Parameters

ParameterTypeDescription
rowsreadonly TableRow[]The table rows to add.
optionsTableOptionsOptions that control the operation.

Returns

this


text()

ts
text(text, options): this;

Defined in: src/document.ts:628

Adds tagged text to this structure container.

Parameters

ParameterTypeDescription
textstringThe text to add.
optionsTextOptionsOptions that control the operation.

Returns

this


textBlock()

ts
textBlock(text, options): this;

Defined in: src/document.ts:646

Adds a tagged multiline text block to this structure container.

Parameters

ParameterTypeDescription
textstringThe text to add.
optionsTextBlockOptionsOptions that control the operation.

Returns

this


tiff()

ts
tiff(data, options): this;

Defined in: src/document.ts:752

Adds a tagged TIFF image to this structure container.

Parameters

ParameterTypeDescription
dataBinaryDataThe binary image or font data.
optionsTiffImageOptionsOptions that control the operation.

Returns

this


webp()

ts
webp(data, options): this;

Defined in: src/document.ts:774

Adds a tagged WebP image to this structure container.

Parameters

ParameterTypeDescription
dataBinaryDataThe binary image or font data.
optionsWebpImageOptionsOptions that control the operation.

Returns

this

Released under the ISC license.