modern-pdf-lib / PdfWriter
Class: PdfWriter
Defined in: src/core/pdfWriter.ts:116
Serialize a PDF document to a Uint8Array.
const writer = new PdfWriter(registry, structure, options);
const bytes = writer.write();Constructors
Constructor
new PdfWriter(
registry,structure,options?):PdfWriter
Defined in: src/core/pdfWriter.ts:124
Parameters
registry
All indirect objects.
structure
Document structure references.
options?
Returns
PdfWriter
Methods
write()
write():
Uint8Array
Defined in: src/core/pdfWriter.ts:144
Produce the complete PDF file as a Uint8Array.
Returns
Uint8Array
writeBodyWithObjectStreams()
writeBodyWithObjectStreams(
threshold):boolean
Defined in: src/core/pdfWriter.ts:275
Write the document body using object streams when the number of eligible non-stream objects exceeds threshold.
Parameters
threshold
number
Returns
boolean
true if object streams (and a cross-reference stream) were used and the PDF is complete. false if the threshold was not met — in that case the body has been written in traditional format and the caller must still emit the classic xref table and trailer.