Function htmlToPdf

  • Converts the specified HTML code into a PDF document.

    Parameters

    • html: string

      The HTML code to convert.

    • options: {
          browser?: LaunchOptions;
          pdf?: {
              displayHeaderFooter?: boolean;
              footerTemplate?: string;
              format?: string;
              headerTemplate?: string;
              height?: string | number;
              landscape?: boolean;
              margin?: {
                  bottom?: string | number;
                  left?: string | number;
                  right?: string | number;
                  top?: string | number;
              };
              outline?: boolean;
              pageRanges?: string;
              path?: string;
              preferCSSPageSize?: boolean;
              printBackground?: boolean;
              scale?: number;
              tagged?: boolean;
              width?: string
              | number;
          };
      } = {}

      The rendering options.

    Returns Promise<Buffer>

    The PDF document corresponding to the specified HTML code.