import type { DocumentInitParameters, RenderParameters } from "pdfjs-dist/types/src/display/api.js"; export type PdfMetadata = { Title?: string; Author?: string; Producer?: string; Creator?: string; CreationDate?: string; ModDate?: string; }; export type Options = { /** For cases where the PDF is encrypted with a password */ password?: string; /** defaults to `1`. If you want high-resolution images, increase this */ scale?: number; /** render parameters which are passed to `PdfPage#render` */ renderParams?: Omit; /** document init parameters which are passed to pdfjs.getDocument */ docInitParams?: Partial; }; export interface Pdf extends AsyncDisposable, AsyncIterable { length: number; metadata: PdfMetadata; isDestroyed: boolean; getPage(pageNumber: number): Promise; destroy(): Promise; } /** * Converts a PDF to a series of images. This returns a `Symbol.asyncIterator` * * @param input Either (a) the path to a pdf file, or (b) a data url, or (b) a buffer, (c) a buffer, or (e) a ReadableStream. * * @example * ```js * import pdf from "pdf-to-img"; * * for await (const page of await pdf("example.pdf")) { * expect(page).toMatchImageSnapshot(); * } * * // or if you want access to more details: * * const doc = await pdf("example.pdf"); * expect(doc.length).toBe(1); * expect(doc.metadata).toEqual({ ... }); * * for await (const page of doc) { * expect(page).toMatchImageSnapshot(); * } * * doc.destroy(); * ``` */ export declare function pdf(input: string | Uint8Array | Buffer | NodeJS.ReadableStream, options?: Options): Promise;