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:
- context
dict,optional Additional rendering context.
- item_filter
str,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.- margins
dict[str,str],optional Page margins with
top,right,bottom, andleftPlaywright PDF lengths. If omitted, 10 mm margins are used on every side.- render_timeout
float,optional Maximum time, in seconds, to wait for browser readiness signals. Default
30.0.- **kwargs
Any Additional keyword arguments used to fetch the report template. At least one keyword argument must be provided.
- context
- Returns:
bytesPDF content generated by headless Chromium.
- Raises:
ADRExceptionIf no keyword arguments are provided or browser PDF rendering fails.
ImproperlyConfiguredErrorIf
static_directoryis not configured.