PDFiumPageBuilder
Defined in: src/document/builder.ts:227
Builder for adding content to a PDF page.
Obtained from PDFiumDocumentBuilder.addPage. Use method chaining to add shapes, text, and other page objects.
Content is generated automatically when the document is saved — there is
no need to call generateContent() on builder pages.
Example
Section titled “Example”using builder = pdfium.createDocument();const page = builder.addPage({ width: 595, height: 842 });const font = builder.loadStandardFont('Helvetica');page .addRectangle(50, 700, 200, 100, { fill: { r: 200, g: 220, b: 255, a: 255 } }) .addText('Hello, PDF!', 60, 750, font, 24);const bytes = builder.save();Extends
Section titled “Extends”Accessors
Section titled “Accessors”disposed
Section titled “disposed”Get Signature
Section titled “Get Signature”get disposed():
boolean
Defined in: src/core/disposable.ts:73
Whether this resource has been disposed.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”[dispose]()
Section titled “[dispose]()”[dispose]():
void
Defined in: src/core/disposable.ts:148
Dispose of this resource, freeing WASM memory.
This method is idempotent - calling it multiple times has no effect after the first call.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”addRectangle()
Section titled “addRectangle()”addRectangle(
x,y,w,h,style?):this
Defined in: src/document/builder.ts:252
Add a rectangle to the page.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
x | number | Left position in points |
y | number | Bottom position in points |
w | number | Width in points |
h | number | Height in points |
style? | ShapeStyle | Fill and stroke style options |
Returns
Section titled “Returns”this
this for method chaining
addText()
Section titled “addText()”addText(
text,x,y,font,fontSize):this
Defined in: src/document/builder.ts:281
Add a text object to the page.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
text | string | The text content |
x | number | X position in points |
y | number | Y position in points |
font | PDFiumBuilderFont | Font from builder.loadStandardFont() |
fontSize | number | Font size in points |
Returns
Section titled “Returns”this
this for method chaining
dispose()
Section titled “dispose()”dispose():
void
Defined in: src/core/disposable.ts:164
Alias for Symbol.dispose for explicit calls.
Returns
Section titled “Returns”void
Example
Section titled “Example”document.dispose();