modern-pdf-lib / linearizePdf
Function: linearizePdf()
linearizePdf(
pdfBytes,options?):Promise<Uint8Array<ArrayBufferLike>>
Defined in: src/core/linearization.ts:214
Linearize a PDF document for fast web viewing.
This reorganizes the PDF so that:
- A linearization parameter dictionary appears first
- Objects needed for the first page appear early in the file
- A hint table describes page offsets
Note: This is a simplified linearization. For production use with very large documents, a full implementation following PDF spec Appendix F is recommended.
Parameters
pdfBytes
Uint8Array
The raw PDF bytes.
options?
Linearization options.
Returns
Promise<Uint8Array<ArrayBufferLike>>
The linearized PDF bytes.