renderer.ts

Source

2 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.

Reference

fnrenderHtmlToPng(page: Page, html: string, width: number, height: number, publicDir?: string): Promise<Buffer>Renders an HTML string to a PNG buffer using Chromium.

Renders an HTML string to a PNG buffer using Chromium.

View source

Parameters

  • page Page

    Playwright page instance

  • html string

    HTML string from template function

  • width number

    Image width

  • height number

    Image height

  • publicDir string

    Optional public directory for serving local assets (images, fonts, etc.) — optional

Returns

Promise

PNG buffer

fnwrapHtml(bodyHtml: string, width: number, height: number, useBaseUrl: boolean): stringWraps template HTML in a minimal document with viewport locked to given dimensi…

Wraps template HTML in a minimal document with viewport locked to given dimensions.

View source

Parameters

  • bodyHtml string
  • width number
  • height number
  • useBaseUrl boolean

Returns

string