tools.pdf_generator module

Advanced PDF Generator Tool.

Creates complex PDFs from JSON specifications with text, images, tables, headers, links, and various styling options across multiple pages.

class tools.pdf_generator.LinkFlowable(text, url, style=None)[source]

Bases: Flowable

LinkFlowable (inherits from Flowable).

text

The text.

url

The url.

style

The style.

width

The width.

height

The height.

paragraph

The paragraph.

__init__(text, url, style=None)[source]

Initialize the instance.

Parameters:
  • text – Text content.

  • url – URL string.

  • style – The style value.

wrap(availWidth, availHeight)[source]

Wrap.

Parameters:
  • availWidth – The availWidth value.

  • availHeight – The availHeight value.

draw()[source]

Draw.

class tools.pdf_generator.PDFGenerator(page_size='A4')[source]

Bases: object

PDFGenerator.

Parameters:

page_size (str)

page_size

The page size.

styles

The styles.

__init__(page_size='A4')[source]

Initialize the instance.

Parameters:

page_size (str) – The page size value.

generate_pdf(pdf_spec)[source]

Generate pdf.

Parameters:

pdf_spec – The pdf spec value.

async tools.pdf_generator.run(pdf_spec, filename=None, ctx=None)[source]

Execute this tool and return the result.

Parameters:
  • pdf_spec (str) – The pdf spec value.

  • filename (str) – The filename value.

  • ctx (ToolContext | None) – Tool execution context providing access to bot internals.

Returns:

Result string.

Return type:

str