export_browser_pdf#
- Report.export_browser_pdf(file_name: str, *, query_params: dict | None = None, item_filter: str | None = None, landscape: bool = False, margins: dict[str, str] | None = None, render_timeout: float = 30.0) bool#
Export report as a browser-fidelity PDF.
Unlike
export_pdf(), which uses the legacy server-side PDF path, this method asks a headless browser to render the report through ADR’s browser-facing output and then print that browser view to PDF.- Parameters:
- file_name
str Path and filename for the PDF file to export.
- query_params
dict,optional Dictionary for parameters to apply to the report template. These values are forwarded as report-generation URL query parameters. Default: None
- item_filter
str,optional String corresponding to query to run on the database items before rendering the report. Default: None
- landscapebool,
optional Whether to export the PDF in landscape orientation. Default: False
- margins
dict[str,str],optional Page margins with
top,right,bottom, andleftvalues expressed as strings using unitless pixels or thepx,in,cm, ormmunits (for example"10mm"or"0.5in"). Default: None, which uses the renderer defaults.- render_timeout
float,optional Maximum time, in seconds, to spend waiting for browser readiness signals. Default: 30.0
- file_name
- Returns:
- bool
Success status of the browser PDF export: True if it worked, False otherwise
Examples
import ansys.dynamicreporting.core as adr adr_service = adr.Service(ansys_installation = r'C:\Program Files\ANSYS Inc\v271') ret = adr_service.connect(url = "http://localhost:8000", username = "nexus", password = "cei") my_report = adr_service.get_report(report_name = "My Top Report") succ = my_report.export_browser_pdf(file_name = r'D:\tmp\myreport.pdf', query_params = {"colormode": "dark"}, landscape = True)