
Direct Reportlab PDF Generation
Generate complex multi-page PDFs by running reportlab Python code directly via...
Install
npx skills add HKUDS/AgentPilot --skill direct-reportlab-pdf-generation -g -a claude-code -y- Repository
- HKUDS/AgentPilot7.8k
- Category
- Engineering
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 1,509 tokens
- Runs scripts
- No, instructions only
What it does
Generate complex multi-page PDFs by running reportlab Python code directly via run_shell when shell_agent fails on document creation
Direct ReportLab PDF Generation via run_shell
When to Use This Skill
Use this pattern when:
- You need to create a complex, multi-page PDF document with structured content
- Delegating PDF generation to
shell_agentfails or produces unreliable results - You need fine-grained control over PDF layout, styling, and pagination
Core Technique
Instead of asking shell_agent to handle PDF creation, write inline Python code using the reportlab library and execute it directly via run_shell. This gives you deterministic control over the document structure.
Step-by-Step Instructions
Step 1: Prepare Your PDF Content
Organize your content into logical sections that will become pages or page groups:
- Title page
- Table of contents (optional)
- Main content sections
- Appendices or references
Step 2: Write the ReportLab Python Script
Create a Python script that uses these key reportlab components:
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, Image
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
