Pdf Generator

Generate professional PDFs from Markdown, HTML, data, or code. Reports, invoices, contracts, and documents with best practices.

Iván

@ivangdavila

Install

$ openclaw skills install @ivangdavila/pdf-generator

When to Use

User needs to create, generate, or export PDF documents. Agent handles document generation from multiple sources (Markdown, HTML, JSON, templates), formatting, styling, and batch processing.

Scope

This skill ONLY:

  • Provides code patterns and implementation guidance for PDF generation
  • Explains tool selection, CSS for print, and document structure
  • Shows reference examples for common document types

This skill NEVER:

  • Executes code or generates files directly
  • Makes network requests
  • Accesses files outside user's working directory

All code examples are reference patterns for the user to implement.

Quick Reference

TopicFile
Tool selectiontools.md
Document typestemplates.md
Advanced operationsadvanced.md

Core Rules

1. Choose the Right Tool

SourceBest ToolWhy
MarkdownpandocNative support, TOC, templates
HTML/CSSweasyprintBest CSS support, no LaTeX
Data/JSONreportlabProgrammatic, precise control
Simple textfpdf2Lightweight, fast

Default recommendation: weasyprint for most HTML-based documents.

2. Structure Before Style

# CORRECT: semantic structure
html = """
<article>
  <header><h1>Report Title</h1></header>
  <section>
    <h2>Summary</h2>
    <p>Content...</p>
  </section>
</article>
"""

# WRONG: style-first approach
html = "<div style='font-size:24px'>Report Title</div>"

3. Handle Page Breaks Explicitly

/* Force page break before */
.new-page { page-break-before: always; }

/* Keep together */
.keep-together { page-break-inside: avoid; }

/* Headers never orphaned */
h2, h3 { page-break-after: avoid; }

4. Always Set Metadata

# Example pattern for weasyprint
html = """
<html>
<head>
  <title>Document Title</title>
  <meta name="author" content="Author Name">
</head>
...
"""

5. Use Print-Optimized CSS

@media print {
  body {
    font-family: 'Georgia', serif;
    font-size: 11pt;
    line-height: 1.5;
  }
  
  @page {
    size: A4;
    margin: 2cm;
  }
  
  .no-print { display: none; }
}

6. Validate Output

After generating any PDF:

  1. Check file size (0 bytes = failed)
  2. Open and verify page count
  3. Verify fonts render correctly

Common Traps

TrapConsequenceFix
Missing fontsFallback to defaultsUse web-safe fonts
Absolute image pathsImages missingUse relative paths
No page sizeUnpredictable layoutSet @page { size: A4; }
Large imagesHuge filesCompress before use

Security & Privacy

This is a reference skill. It provides patterns and guidance only.

Data that stays local:

  • All PDF generation happens on user's machine
  • No data sent externally

This skill does NOT:

  • Execute code or make files
  • Make network requests
  • Access system files

Feedback

  • If useful: clawhub star pdf-generator
  • Stay updated: clawhub sync

Related skills

AI Proposal Generator

@jeffjhunter

Generate professional HTML proposals from meeting notes. Features 5 proposal styles (Corporate, Entrepreneur, Creative, Consultant, Minimal), 6+ color themes, and a Design Wizard for custom templates. Triggers on "create proposal", "proposal for [client]", "proposal wizard", "proposal from [notes]", "show proposal styles", "finalize proposal". Integrates with ai-meeting-notes for context. Outputs beautiful, responsive HTML ready to send or export as PDF.

95.0k

Skywork Document

@gxcun17

Skywork Document (skywork) - Use for ANY task producing a document output. Generates professional documents in docx, pdf, markdown, and html. Capabilities: (...

233.0k

Resume / CV Builder

@sebastian-buitrag0

Create professional resumes and CVs. Generate ATS-friendly formats, optimize bullet points, tailor for specific jobs, and export to multiple formats (Markdown, HTML, LaTeX, PDF).

75.0k

Pdf

@awspace

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

6447k

Pdf To Structured

@datadrivenconstruction

Extract structured data from construction PDFs. Convert specifications, BOMs, schedules, and reports from PDF to Excel/CSV/JSON. Use OCR for scanned documents and pdfplumber for native PDFs.

94.7k

Pdf Document Generation Cellcog

@nitishgargiitd

AI PDF document generation powered by CellCog — PDF and DOCX output. Resumes, contracts, reports, proposals, invoices, certificates, NDAs, letters, brochures...

64.3k