Module serve

Classes

class PDFDoc (header: Optional[MarkupObject], footer: Optional[MarkupObject], *args, **kwargs)

Class representing a PDF document. It can contain multiple pages, a header and footer. It is possible to add a new page with the new_page method. The document can be rendered to a string with the render method.

Args:

template: The template file as a string. Can be a full markup file or a component.
format_: This is a regex expression that should contain only one '.*?'. It corresponds to the key thatwill be replaced by the data when the render method is called.

Parent

Methods

def new_page(self, header: bool = False, footer: bool = False) ‑> PDFPage

Creates a new page and returns a reference to it.

Returns:

The new page object
class PDFPage (*args, **kwargs)

Class representing a page in a PDF document. It can contain multiple children objects. It is possible to append a component to the page with the append method. Once the page is built, it can be rendered to a string with the render method.

Args:

template: The template file as a string. Can be a full markup file or a component.
format_: This is a regex expression that should contain only one '.*?'. It corresponds to the key thatwill be replaced by the data when the render method is called.

Parent

Methods

def append(self, obj: MarkupObject)

Append a child object to the page. The child objects must be pre-rendered before calling this method. Call the object and gives it the necessary data to render before appending it to the page.

Args:

obj: The object to append to the page

Returns:

None
class PDFRenderer (report_title: str = 'Financial Report', style: str = 'light')

Renders a report with the same information as the HTML renderer, but in a PDF format. The three styles are: - light: A light theme - dark: A dark theme (Darcula style) - rich: Another dark theme with another color palette

Args:

report_title: The title of the report
style: The theme of the report. Can be "light", "dark" or "rich"

Parent