---
name: pdf-builder
description: Create, generate, and manipulate PDF documents. Use for PDF creation, document generation, reports, invoices, forms, and any PDF-related tasks. Activate when user mentions PDF, document generation, or creating formatted files.
license: MIT
compatibility: Requires file system access and Python with reportlab
allowed-tools: create_file write_to_file read_file run_code
---

## Goal

Help users create and generate PDF documents for various purposes including reports, invoices, forms, and documentation. You can generate content and create PDFs directly.

## Capabilities

### PDF Creation
- Generate PDF documents from scratch with content
- Create formatted PDF reports
- Generate invoices and receipts
- Create forms and templates
- Add text, tables, images, and formatting

### Content Generation
- Generate appropriate content based on user requests
- Create structured documents with headers, sections, and formatting
- Add tables with data
- Include images and graphics

### Document Formatting
- Add text with various fonts and sizes
- Insert images and graphics
- Create tables and layouts
- Add headers and footers
- Page numbers and styling

## Procedure

1. When user requests a PDF:
   - Understand what content they want (intro, report, etc.)
   - Generate appropriate content if not provided
   - Create Python code using reportlab to generate the PDF
   - Use `run_code` tool to execute the code and create the PDF

2. For content generation:
   - If user doesn't provide specific content, generate relevant content based on the topic
   - Structure content appropriately (title, sections, paragraphs)
   - Add tables if relevant data can be included
   - Make it informative and well-formatted

3. For PDF generation:
   - Use reportlab library (SimpleDocTemplate, Paragraph, Table, etc.)
   - Set appropriate page size (letter, A4)
   - Add proper styling and formatting
   - Save with descriptive filename

## Best Practices

- Always generate content if user doesn't provide it
- Use standard page sizes (A4, Letter)
- Maintain consistent styling throughout
- Ensure text is readable (font size 10-12pt minimum)
- Include proper structure (title, sections, content)
- Add tables for structured data when appropriate
- Use `run_code` to execute the PDF generation immediately

## Examples

For detailed ReportLab code examples, see `references/reportlab_examples.md`

User: "Create a PDF intro to Lahore"
→ Generate content about Lahore (history, culture, landmarks)
→ Create Python code with reportlab
→ Use `run_code` to execute and generate the PDF
→ Include tables with key facts/statistics

User: "Make a PDF report with charts"
→ Generate report content
→ Create multi-page PDF with text, tables
→ Execute code to create the file

User: "Generate a PDF invoice"
→ Create invoice template with sample data
→ Generate PDF with proper formatting
→ Execute to create the file
