render_report_as_browser_pdf#

ADR.render_report_as_browser_pdf(*, context: dict | None = None, item_filter: str = '', dark_mode: bool = False, landscape: bool = False, margins: dict[str, str] | None = None, render_timeout: float = 30.0, **kwargs: Any) bytes#

Render a report as a browser-fidelity PDF byte stream via headless Chromium.

Unlike render_report_as_pdf() which uses WeasyPrint (static CSS rendering), this method produces PDF output that matches the on-screen browser appearance by using Playwright + headless Chromium.

Parameters:
contextdict, optional

Additional rendering context.

item_filterstr, optional

Filter expression for report items.

dark_modebool, optional

Whether to render using a dark theme. Default False.

landscapebool, optional

Whether to use landscape orientation. Default False.

marginsdict[str, str], optional

Page margins with top, right, bottom, and left Playwright PDF lengths. If omitted, 10 mm margins are used on every side.

render_timeoutfloat, optional

Maximum time, in seconds, to wait for browser readiness signals. Default 30.0.

**kwargsAny

Additional keyword arguments used to fetch the report template. At least one keyword argument must be provided.

Returns:
bytes

PDF content generated by headless Chromium.

Raises:
ADRException

If no keyword arguments are provided or browser PDF rendering fails.

ImproperlyConfiguredError

If static_directory is not configured.