Appearance
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
| Parameter | Type | Description |
|---|---|---|
page | InternalPageModel | The internal page model to write into. |
embeddedFonts | ReadonlyMap<string, ParsedTrueTypeFont> | The embedded font registry used for text layout. |
node | InternalStructureNode | The parent structure node for tagged content. |
fontFamilies | ReadonlyMap<string, FontFamilyFaces> | Font families registered with the document. |
textDefaults? | TextDefaults | Document-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
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The binary image or font data. |
options | BmpImageOptions | Options 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
| Parameter | Type |
|---|---|
cx | number |
cy | number |
radius | number |
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
| Parameter | Type | Description |
|---|---|---|
tag | PdfContainerTag | The structure tag to create. |
build? | (container) => void | An 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
| Parameter | Type | Description |
|---|---|---|
tag | PdfContainerTag | The structure tag to create. |
options? | PdfStructureOptions | Options that control the operation. |
build? | (container) => void | An 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
| Parameter | Type |
|---|---|
cx | number |
cy | number |
rx | number |
ry | number |
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
| Parameter | Type | Description |
|---|---|---|
options | FlowOptions | Options that control the operation. |
Returns
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
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The binary image or font data. |
options | GifImageOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The image bytes. |
options | JpegImageOptions | Placement 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
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The binary image or font data. |
options | Jbig2ImageOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The binary image or font data. |
options | Jp2ImageOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The binary image or font data. |
options | JpegImageOptions | Options 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
| Parameter | Type |
|---|---|
x1 | number |
y1 | number |
x2 | number |
y2 | number |
style? | ShapeStyle |
Returns
this
link()
ts
link(url, options): this;Defined in: src/document.ts:808
Adds a tagged URI link annotation to this structure container.
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | The URI target. |
options | UriLinkOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
items | readonly ListItem[] | The list items to add. |
options | ListOptions | Options 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
| Parameter | Type |
|---|---|
commands | PathCommand[] |
style | PathStyle |
Returns
this
png()
ts
png(data, options): this;Defined in: src/document.ts:719
Adds a tagged PNG image to this structure container.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The binary image or font data. |
options | PngImageOptions | Options 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
| Parameter | Type |
|---|---|
x | number |
y | number |
width | number |
height | number |
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
| Parameter | Type | Description |
|---|---|---|
role | | string & object | PdfStandardStructureTag | The replacement structure role. |
build? | (container) => void | An 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
| Parameter | Type | Description |
|---|---|---|
role | | string & object | PdfStandardStructureTag | The replacement structure role. |
options? | PdfStructureOptions | Options that control the operation. |
build? | (container) => void | An 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
| Parameter | Type | Description |
|---|---|---|
data | string | BinaryData | The SVG text data. |
options | SvgImageOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
rows | readonly TableRow[] | The table rows to add. |
options | TableOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
text | string | The text to add. |
options | TextOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
text | string | The text to add. |
options | TextBlockOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The binary image or font data. |
options | TiffImageOptions | Options 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
| Parameter | Type | Description |
|---|---|---|
data | BinaryData | The binary image or font data. |
options | WebpImageOptions | Options that control the operation. |
Returns
this