UNPKG

@ironsoftware/ironpdf

Version:

IronPDF for Node

48 lines 2.61 kB
/// <reference types="node" /> /// <reference types="node" /> /// <reference types="node" /> import { Buffer } from "buffer"; import { Readable } from "stream"; import { LinearizationMode } from "../../../public/render"; /** * Check if the given PDF bytes represent a linearized ("Fast Web View") PDF. */ export declare function isLinearizedFromBytes(pdfBytes: Buffer, password?: string): Promise<boolean>; /** * Linearize a PDF held by the engine (by document id) and return the linearized bytes * via the {@code QPdf_Linearization_LinearizeInMemoryFromId} unary-request/server-streaming RPC. */ export declare function linearizeInMemoryFromId(id: string, password?: string): Promise<Buffer>; /** * Linearize a PDF held by the engine (by document id) and stream the linearized bytes * as a {@link Readable}. Useful for piping to HTTP responses or file streams without * buffering the entire PDF in memory. */ export declare function linearizeInMemoryFromIdStream(id: string, password?: string): Promise<Readable>; /** * Linearize a PDF provided as raw bytes and return the linearized bytes via the * bidirectional streaming {@code QPdf_Linearization_LinearizeInMemory} RPC. */ export declare function linearizeInMemoryFromBytes(pdfBytes: Buffer, password?: string): Promise<Buffer>; /** * Core linearization logic shared across all linearization entry points. Implements the * {@link LinearizationMode} strategy pattern. Mirrors {@code PdfDocument.LinearizePdfCore} * on the C# side. */ export declare function linearizeCoreFromBytes(pdfBytes: Buffer, password?: string, mode?: LinearizationMode): Promise<Buffer>; /** * Variant of {@link linearizeCoreFromBytes} that starts from an open document on the engine. * For {@link LinearizationMode.InMemory} we use the cheap document-id RPC; for the disk-based * paths we have to fetch the bytes once and delegate to {@link linearizeCoreFromBytes}. */ export declare function linearizeCoreFromId(id: string, getBytes: () => Promise<Buffer>, password?: string, mode?: LinearizationMode): Promise<Buffer>; /** * Linearize a PDF provided as raw bytes and save the result to disk via the file-based * streaming {@code QPdf_Linearization_SaveAsLinearizedFromBytes} RPC. * * Mirrors the in-memory behavior used by {@link compressInMemory} in {@code compress.ts}: * the engine streams the linearized bytes back, and we concatenate and persist them * locally at {@code outputPath}. */ export declare function saveAsLinearizedFromBytes(pdfBytes: Buffer, outputPath: string, password?: string): Promise<Buffer>; //# sourceMappingURL=linearize.d.ts.map