render_report_as_pdf#

ADR.render_report_as_pdf(*, context: dict | None = None, item_filter: str = '', **kwargs: Any) bytes#

Render a report as a PDF byte stream.

Parameters:
contextdict, optional

Context to pass to the report template.

item_filterstr, optional

ADR filter applied to items in the report.

**kwargsAny

Additional keyword arguments to pass to the report template. Eg: guid, name, etc. At least one keyword argument must be provided to fetch the report.

Returns:
bytes

PDF document bytes (media type application/pdf).

Raises:
ADRException

If no keyword arguments are provided or if the report rendering fails.

Examples

>>> from ansys.dynamicreporting.core.serverless import ADR
>>> adr = ADR(ansys_installation=r"C:\Program Files\ANSYS Inc\v252", db_directory=r"C:\DBs\docex")
>>> adr.setup()
>>> pdf_stream = adr.render_report_as_pdf(name="Serverless Simulation Report")
>>> with open("report.pdf", "wb") as f:
...     f.write(pdf_stream)