Get the FREE Ultimate OpenClaw Setup Guide →

pdf

Scanned
npx machina-cli add skill openai/skills/pdf --openclaw
Files (1)
SKILL.md
2.5 KB

PDF Skill

When to use

  • Read or review PDF content where layout and visuals matter.
  • Create PDFs programmatically with reliable formatting.
  • Validate final rendering before delivery.

Workflow

  1. Prefer visual review: render PDF pages to PNGs and inspect them.
    • Use pdftoppm if available.
    • If unavailable, install Poppler or ask the user to review the output locally.
  2. Use reportlab to generate PDFs when creating new documents.
  3. Use pdfplumber (or pypdf) for text extraction and quick checks; do not rely on it for layout fidelity.
  4. After each meaningful update, re-render pages and verify alignment, spacing, and legibility.

Temp and output conventions

  • Use tmp/pdfs/ for intermediate files; delete when done.
  • Write final artifacts under output/pdf/ when working in this repo.
  • Keep filenames stable and descriptive.

Dependencies (install if missing)

Prefer uv for dependency management.

Python packages:

uv pip install reportlab pdfplumber pypdf

If uv is unavailable:

python3 -m pip install reportlab pdfplumber pypdf

System tools (for rendering):

# macOS (Homebrew)
brew install poppler

# Ubuntu/Debian
sudo apt-get install -y poppler-utils

If installation isn't possible in this environment, tell the user which dependency is missing and how to install it locally.

Environment

No required environment variables.

Rendering command

pdftoppm -png $INPUT_PDF $OUTPUT_PREFIX

Quality expectations

  • Maintain polished visual design: consistent typography, spacing, margins, and section hierarchy.
  • Avoid rendering issues: clipped text, overlapping elements, broken tables, black squares, or unreadable glyphs.
  • Charts, tables, and images must be sharp, aligned, and clearly labeled.
  • Use ASCII hyphens only. Avoid U+2011 (non-breaking hyphen) and other Unicode dashes.
  • Citations and references must be human-readable; never leave tool tokens or placeholder strings.

Final checks

  • Do not deliver until the latest PNG inspection shows zero visual or formatting defects.
  • Confirm headers/footers, page numbering, and section transitions look polished.
  • Keep intermediate files organized or remove them after final approval.

Source

git clone https://github.com/openai/skills/blob/main/skills/.curated/pdf/SKILL.mdView on GitHub

Overview

This skill covers reading, generating, and reviewing PDFs where rendering and layout matter. It advocates visual validation by rendering pages with Poppler and using Python tools like reportlab for creation and pdfplumber/pypdf for extraction, ensuring accurate formatting before delivery.

How This Skill Works

Render existing PDFs to PNGs for inspection (pdftoppm, with Poppler as fallback). Generate new PDFs with reportlab, and use pdfplumber or pypdf for text extraction and quick checks. After each meaningful update, re-render to confirm alignment, spacing, and legibility.

When to Use It

  • Read or review PDFs where layout and visuals matter
  • Create PDFs programmatically with reliable formatting
  • Validate final rendering before delivery
  • Verify headers, footers, and page transitions after edits
  • Render PDFs locally to confirm cross-environment fidelity

Quick Start

  1. Step 1: Render an existing PDF to PNGs using pdftoppm for visual review
  2. Step 2: Generate a new document with reportlab, then render and verify
  3. Step 3: Extract text with pdfplumber or pypdf for checks and repeat as needed

Best Practices

  • Prefer visual review: render pages to PNGs (pdftoppm) and inspect
  • Use reportlab for robust PDF generation
  • Use pdfplumber or pypdf for text extraction, not layout fidelity
  • Keep tmp/pdfs/ for intermediates and output/pdf/ for final artifacts
  • Ensure ASCII hyphens only and keep filenames descriptive

Example Use Cases

  • Generate a product spec PDF with consistent typography and layout
  • Audit an invoice PDF by rendering pages and verifying spacing
  • Extract searchable text from PDFs for indexing
  • Deliver a client brochure after visual confirmation of charts and tables
  • Update a report and re-render to confirm headers and page breaks

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers