///
import PDFDocument from 'pdfkit';
import type { H3Event } from 'h3';
import type { WriteStream } from 'node:fs';
import type { PDFDocumentType } from '../types';
export interface LayoutOptions {
header?: {
render: (doc: PDFDocumentType) => Promise | void;
height: number;
};
footer?: {
render: (doc: PDFDocumentType) => Promise | void;
height: number;
};
}
/**
* Create a blank pdfkit-PDF to be filled with life later on.
*
* @param options Configure PDF. Optional, otherwise the defaults set in the Nuxt Config will be used.
* @param data Data to attach to PDF object, for later, global consumption during PDF creation
* @param streamToFile Stream to write PDF to while creating the pdf. In the end this stream can be stored to a file, or streamed to an email server, or ...
*/
export declare function createPDF(options?: PDFKit.PDFDocumentOptions, data?: TData, layout?: LayoutOptions, streamToFile?: WriteStream): PDFDocumentType;
/**
* Render a PDFDocument using an H3Event.
* Return this function at the end of your event handler.
*
* @param event The H3Event passed from the Event handler
* @param pdf The created PDF Object from createPDF. This can be a promise or a static object
*/
export declare const streamReturnPDF: (event: H3Event, pdf: PDFKit.PDFDocument | Promise) => Promise;