/// import { PDFOptions, PuppeteerLaunchOptions, Browser } from 'puppeteer'; import { HandlebarsHelpers } from './handlebars-helpers'; export interface GeneratePdfOptions { /** Path to the Handlebars template file. */ templateFilePath: string; /** One object per page. Each entry renders the template once; results are concatenated. */ dataPerPage: Array; /** Where to write the PDF. Required unless `useStream` is true. */ pdfFilePath?: string; /** Return a Readable stream of the PDF instead of writing to disk. */ useStream?: boolean; /** Plain object of `{ name: fn }` Handlebars helpers. Preferred over `helpersFilePath`. */ helpers?: HandlebarsHelpers; /** * Path to a JSON file of helpers whose values are stringified function bodies. * @deprecated Use `helpers` instead — this path runs `new Function` on file contents. */ helpersFilePath?: string; /** Puppeteer launch options (only used by the singleton `generatePdf` on first call). */ puppeteerOptions?: PuppeteerLaunchOptions; /** Puppeteer PDF options. Merged on top of A4 / 10mm margin defaults. */ pdfOptions?: PDFOptions; } /** * A caller-owned PDF generator. Holds its own Puppeteer Browser instance — * isolated from the module singleton used by `generatePdf` / `closeBrowser`. * * @example * const gen = new PdfGenerator(); * try { * await gen.generate({ templateFilePath, dataPerPage, pdfFilePath }); * } finally { * await gen.close(); * } */ export declare class PdfGenerator { private browserPromise; private readonly launchOptions; constructor(launchOptions?: PuppeteerLaunchOptions); /** Force the browser to launch now instead of on first `generate()`. */ warmup(): Promise; generate(options: GeneratePdfOptions): Promise; close(): Promise; } /** * Generate a PDF using the shared module-level browser singleton. * Call `closeBrowser()` when you're done. For long-running servers or test * suites, prefer the `PdfGenerator` class. */ export declare const generatePdf: (options: GeneratePdfOptions) => Promise;