home / skills / aidotnet / moyucode / pdf-generator

pdf-generator skill

/skills/tools/pdf-generator

This skill generates PDFs from HTML, Markdown, or text with customizable templates, styles, and page configurations to meet formatting needs.

npx playbooks add skill aidotnet/moyucode --skill pdf-generator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1001 B
---
name: pdf-generator
description: 从HTML、Markdown或文本内容生成PDF文档,支持模板、样式和页面配置。
metadata:
  short-description: 从HTML/Markdown生成PDF
source:
  repository: https://github.com/foliojs/pdfkit
  license: MIT
---

# PDF Generator Tool

## Description
Generate PDF documents from HTML, Markdown, or text with customizable styling and layout.

## Trigger
- `/generate-pdf` command
- User requests PDF generation
- User needs to export document as PDF

## Usage

```bash
# Generate PDF from Markdown
python scripts/generate_pdf.py --input "document.md" --output "document.pdf"

# Generate PDF from HTML
python scripts/generate_pdf.py --input "report.html" --output "report.pdf" --format html

# Generate PDF with custom options
python scripts/generate_pdf.py --input "doc.md" --output "doc.pdf" --title "My Report" --author "John" --page-size A4
```

## Tags
`pdf`, `document`, `export`, `markdown`, `html`

## Compatibility
- Codex: ✅
- Claude Code: ✅

Overview

This skill generates high-quality PDF documents from HTML, Markdown, or plain text with support for templates, custom styles, and page configuration. It streamlines export workflows by converting content into printable, shareable PDFs while preserving layout and typography. The tool exposes command triggers and options to control metadata, page size, and format.

How this skill works

The generator accepts input as Markdown, HTML, or text, applies a chosen template and stylesheet, then renders the result to PDF. Command-line options let you set document metadata (title, author), page parameters (size, margins), and format hints. Under the hood it converts source to an HTML rendering and uses a headless renderer to produce a pixel-perfect PDF.

When to use it

  • Exporting Markdown-based reports or notes to a print-ready PDF
  • Generating invoices, reports, or brochures from HTML templates
  • Batch conversion of text content into consistently styled PDFs
  • Creating downloadable documents for web or email distribution
  • Automating PDF generation in build or CI pipelines

Best practices

  • Prepare a clean HTML or Markdown source with semantic structure for predictable layout
  • Define styles and templates centrally to ensure consistent corporate branding
  • Specify page size and margins explicitly to avoid pagination surprises
  • Use CSS print rules for page breaks, headers, and footers
  • Validate output on common viewers (Acrobat, browser PDF viewers) before distribution

Example use cases

  • Convert a project README or documentation (Markdown) into a styled PDF handbook
  • Render a dynamically generated invoice (HTML template) to PDF for emailing
  • Produce A4 formatted reports with custom headers and footers for printing
  • Batch-create PDF archives from a folder of Markdown blog posts
  • Export meeting notes or research summaries as downloadable PDFs

FAQ

What input formats are supported?

You can provide Markdown, HTML, or plain text as source input; Markdown is converted to HTML before rendering.

How do I control page size and margins?

Set command-line options for page size (e.g., A4, Letter) and margins. Templates can include CSS @page rules for finer control.