vite-plugin-pdf-preview
Version:
Preview modern webpages as PDF
40 lines (36 loc) • 957 B
TypeScript
import { PluginOption } from 'vite';
import ppt from 'puppeteer';
declare type PdfOptions = Omit<ppt.PDFOptions, "path">;
interface PdfPreviewOptions {
/**
* Relative paths to pdf preview files.
*
* @example
* pages: ["/print"]
*
* @example
* pages: ["page.html"]
*/
pages: string[];
/**
* Glob pattern forwarded to file watcher
*
* @see https://github.com/paulmillr/chokidar#api
*/
watch?: string | string[];
/**
* Forwarded to puppeteer pdf function.
* Property `path` is omitted and can be configured via `build.outDir`
*
* @see https://pptr.dev/api/puppeteer.pdfoptions
*
* @default
* {
* format = "A4",
* margin = { top: "16px", bottom: "16px" },
* }
*/
pdfOptions?: PdfOptions;
}
declare function pdfPreview({ watch, pages, pdfOptions, }: PdfPreviewOptions): PluginOption;
export { pdfPreview as default };