Skip to content

API Reference parrot_tools.pdfprint

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.pdfprint

View source

Enhanced PDF Print Tool with improved Markdown table support.

Alias AbstractTool

Re-exported from parrot_tools.abstract.AbstractTool.

Alias ExportsToStoreMixin

Re-exported from parrot_tools._exports.ExportsToStoreMixin.

Class PDFPrintArgs

Arguments schema for PDFPrintTool.

Fields:

Field Type Default Description
text str The text content (plaintext or Markdown) to convert to PDF
file_prefix str Prefix for the output filename (timestamp and extension added automatically)
template_name Optional[str] Name of the HTML template to use (e.g., 'report.html'). If None, uses default template
template_vars Optional[Dict[str, Any]] Dictionary of variables to pass to the template (e.g., title, author, date)
stylesheets Optional[List[str]] List of CSS file paths (relative to templates directory) to apply
auto_detect_markdown bool Whether to automatically detect and convert Markdown content to HTML

Method PDFPrintArgs.validate_text

validate_text(v)

Parameter Type Default Description
v

Method PDFPrintArgs.validate_file_prefix

validate_file_prefix(v)

Parameter Type Default Description
v

Method PDFPrintArgs.validate_template_name

validate_template_name(v)

Parameter Type Default Description
v

Class PDFPrintTool

Enhanced PDF Print Tool with improved Markdown table support.

This tool processes both plain text and Markdown content, with special attention to proper table rendering in PDF output.

Parameter Type Default Description
templates_dir Optional[Path] None
default_template str 'report.html'
default_stylesheets Optional[List[str]] None
artifact_store Any None
**kwargs {}

Method PDFPrintTool.execute_sync

Execute PDF generation synchronously.

execute_sync(text: str, file_prefix: str = 'document', template_name: Optional[str] = None, template_vars: Optional[Dict[str, Any]] = None, stylesheets: Optional[List[str]] = None, auto_detect_markdown: bool = True) -> Dict[str, Any]

Parameter Type Default Description
text str Text content to convert to PDF
file_prefix str 'document' Prefix for output filename
template_name Optional[str] None Optional HTML template name
template_vars Optional[Dict[str, Any]] None Optional template variables
stylesheets Optional[List[str]] None Optional CSS stylesheets
auto_detect_markdown bool True Whether to auto-detect Markdown

Returns: Dict[str, Any] — Dictionary with PDF generation results

Method PDFPrintTool.get_available_templates

Get list of available HTML templates.

get_available_templates() -> List[str]

Returns: List[str]

Method PDFPrintTool.get_available_stylesheets

Get list of available CSS stylesheets.

get_available_stylesheets() -> List[str]

Returns: List[str]

Method PDFPrintTool.preview_markdown

Convert Markdown to HTML for preview purposes.

preview_markdown(text: str) -> str

Parameter Type Default Description
text str

Returns: str

Function count_tokens

Count tokens in text using tiktoken.

count_tokens(text: str, model: str = 'gpt-4') -> int

Parameter Type Default Description
text str
model str 'gpt-4'

Returns: int

Alias current_tool_scope

Re-exported from parrot_tools._exports.current_tool_scope.

Alias safe_template_name

Re-exported from parrot_tools._exports.safe_template_name.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally