import { RenderOptions } from '@imprint-pdf/core'; import { ReactElement } from 'react'; /** * Output shape for {@link pdf}. * * - `'response'` (default) — a `Response` whose body is the rendered PDF bytes, * with `Content-Type: application/pdf` headers wired up. Ideal for Next.js * route handlers, Hono, Bun.serve, etc. * - `'bytes'` — a `Uint8Array`. Useful for writing to disk, attaching to email, * or passing into a custom HTTP framework. * - `'stream'` — a `ReadableStream`. Useful for streaming responses * on edge runtimes where memory is constrained. */ type PdfOutput = 'response' | 'bytes' | 'stream'; interface PdfOptions extends RenderOptions { /** Output shape — default `'response'`. */ as?: PdfOutput; /** Suggested filename in the `Content-Disposition` header (response shape only). */ filename?: string; /** `'inline'` displays in the browser, `'attachment'` triggers download. Default `'inline'`. */ disposition?: 'inline' | 'attachment'; } /** * Render a React element to a PDF. Single entry point — picks output shape * via `options.as`, auto-loads `imprint.config.ts` from `process.cwd()`, and * merges caller-supplied options on top. * * @example * ```ts * // Next.js route handler — default Response output: * export const GET = () => pdf(); * * // Power-user escape hatches: * const bytes = await pdf(, { as: 'bytes' }); * const stream = await pdf(, { as: 'stream' }); * ``` */ declare function pdf(element: ReactElement, options?: PdfOptions & { as?: 'response'; }): Promise; declare function pdf(element: ReactElement, options: PdfOptions & { as: 'bytes'; }): Promise; declare function pdf(element: ReactElement, options: PdfOptions & { as: 'stream'; }): Promise>; export { type PdfOptions as P, type PdfOutput as a, pdf as p };