PDF Generator

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

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "PDF Generator" with this command: npx skills add 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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Miaoji Asin Clinic Pro

亚马逊ASIN诊所Pro版,90天行动计划+竞品对标+季节性优化日历。 从合规度、广告度、评论度、视觉度、内容度五维升级为可执行的长期作战方案。 基础功能可使用 miaoji-asin-clinic 免费版。

Registry SourceRecently Updated
Coding

wechat-publish-pro

Pure Python tool to convert Markdown to styled HTML and publish articles to WeChat official account drafts with AI-based content refinement and theme support.

Registry SourceRecently Updated
Coding

Miaoji Asin Clinic

基于ASIN和品类,快速诊断亚马逊Listing五维健康指数并智能排序修复优先级,提供详细分析与个性化修复方案。

Registry SourceRecently Updated
Coding

Toonany

A Claude Code skill for creating AI-generated short dramas (漫剧) from novels and stories. Use when user mentions "漫剧创作", "小说转剧本", "分镜生成", "短剧制作", "故事线生成", "大纲...

Registry SourceRecently Updated