Skip to content

PDF Service (Stack9-core v2.1)

Interface to generate PDF files from HTML string using Puppeteer.

export interface PDFInputOptions {
  html?: string;
  url?: string; // Not supported yet
}

/**
 * @param input (PDFInputOptions)
 * @param options (puppeteer.PDFOptions) https://github.com/puppeteer/puppeteer/blob/v10.2.0/docs/api.md#pagepdfoptions
 */
generate(input: PDFInputOptions, options?: puppeteer.PDFOptions): Promise<Buffer>;

Default values for puppeteer.PDFOptions

{
  "format": "a4",
  "printBacskground": true,
  "preferCSSPageSize": true,
}