Skip to content
Research
Skill

/pdf-generation

Use when creating a PDF report, handout, or poster with Python, or when merging, splitting, rotating, watermarking, encrypting, filling forms in, or extracting tables from an existing PDF inside the Notebook. Covers ReportLab layout with embedded Unicode/CJK fonts, pypdf and

From plugin
open-science
5.5k28 skills

Claude Code

$ npx -y skills add aipoch/open-science --skill pdf-generation --agent claude-code

SKILL.md

pdf-generation.SKILL.md
name: pdf-generation
description: Use when creating a PDF report, handout, or poster with Python, or when merging, splitting, rotating, watermarking, encrypting, filling forms in, or extracting tables from an existing PDF inside the Notebook. Covers ReportLab layout with embedded Unicode/CJK fonts, pypdf and pdfplumber processing, page rendering for visual QA, and Artifact delivery. For reading or citing a library paper, prefer read_document, list_pdf_elements, and read_library_pdf.
license: Apache-2.0

PDF generation and processing

Create new PDFs with ReportLab. Process existing PDFs with pypdf (pages, metadata, forms, encryption), pdfplumber (text with layout, tables), and pypdfium2 (rendering to images). User requirements for content, page size, and design take precedence over the defaults below.

Choose the tool

| Task | Use | | ----------------------------------------------------- | --------------------------------------------------------------------------------------------- | | Read, quote, or summarize a paper or attached PDF | `read_document`, `list_pdf_elements`/`read_pdf_element`, `read_library_pdf`; no code needed | | Create a report or handout | ReportLab Platypus (`SimpleDocTemplate`, `Paragraph`, `Table`, `Image`) | | Precise one-page layouts (poster, certificate, label) | ReportLab `canvas` | | Merge, split, rotate, crop, watermark, encrypt | pypdf | | Extract tables or positioned text | pdfplumber | | Fill a form | `pdf_form_fields` and `fill_pdf_form`, then follow [references/forms.md](references/forms.md) | | Look at pages | `render_pdf_pages` + `host.viewImage` |

Advanced recipes (cropping, bookmarks, links, table styling, pdfplumber settings, OCR, troubleshooting) are in [references/processing.md](references/processing.md).

Setup

Run all PDF code with `notebook_execute`, not the shell. Check packages with `inspect_packages`; install missing ones with `manage_packages` (`language: "python"`, packages `reportlab`, `pypdf`, `pdfplumber`, `pypdfium2`, `pillow`). Never run `pip` in a cell. Poppler, qpdf, pdftk, and LibreOffice are not bundled; do not plan on `pdftotext`, `pdftoppm`, or `qpdf` commands.

Attached files are under `inputs/` relative to the Notebook working directory. Use the exact `notebookPath` shown for each input. Write outputs to the working directory or a subdirectory of it, never into this skill's directory and never over an input.

The registered helpers are injected with `kernelSkillIds`. Call them directly without importing, and repeat `kernelSkillIds` in every cell that uses them:

{
  "kernelSkillIds": ["pdf-generation"],
  "code": "fonts = register_pdf_fonts(cjk=True)\nprint(fonts)"
}

| Helper | Purpose | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `register_pdf_fonts(path=None, bold_path=None, *, cjk=False)` | Registers an embedded TrueType family `OSBody`/`OSBody-Bold` and returns its names. `cjk=True` finds a Chinese/Japanese/Korean system font or raises. Without it, DejaVu Sans (Latin, Greek, math symbols) is used | | `render_pdf_pages(pdf_path, out_dir="pdf-pages", *, pages=None, max_long_edge=1568)` | Writes `page-001.png` and so on for visual QA, returns the paths | | `inspect_pdf(pdf_path)` | Page count and sizes, text-layer presence, outline size, form fields, unembedded fonts | | `pdf_form_fields(pdf_path)` | Fillable fields with page, rect, and allowed values | | `fill_pdf_form(input_pdf, values, output_pdf)` | Validates every value, then writes a new filled PDF |

Creating a report with ReportLab

Fonts come first. ReportLab's built-in fonts (Helvetica, Times) cover only Western European text: Chinese, Greek letters, `±`, `≥`, and `µ` render as black boxes or vanish. Call `register_pdf_fonts` once per cell before building styles. Use `cjk=True` whenever the text may contain CJK characters. If it raises, ask the user for a TrueType font file rather than switching to an unembedded CID font; the Open Science preview may not display unembedded CJK text.

from reportlab.lib import colors
from reportlab.lib.pagesizes i
Read more
@aipoch
Ships withopen-science

The open-source AI research workbench for scientific research and agent workflows. Local-first, model-agnostic desktop app with extensible skills, MCP tools and connectors, Python/R execution and traceable artifacts for reproducible research on macOS, Windows and Linux.

Stars on GitHub

Momentum

stars in total
5.5k
Star history of aipoch/open-science on GitHub, a chart by star-history.com

Other skills on open-science.

alphafold2

alphafold2

Predict protein structure for monomers and multimers with AlphaFold2 via the ColabFold runner (Mirdita et al. 2022,…

@aipoch@aipochInstall Skill
boltz

boltz

Structure prediction for protein, nucleic-acid, and small-molecule complexes with Boltz-2 (Passaro & Wohlwend et al. 2025,…

@aipoch@aipochInstall Skill
borzoi

borzoi

Predict genome-wide functional tracks (RNA-seq, CAGE, DNase, ChIP) from DNA sequence with Borzoi. Use this skill when: (1)…

@aipoch@aipochInstall Skill
chai1

chai1

Structure prediction for protein, nucleic-acid, and small-molecule complexes with the Chai-1 foundation model (Chai Discovery…

@aipoch@aipochInstall Skill
compute-env-setup

compute-env-setup

Prepare reproducible setup instructions and validate a user-managed named software environment on an Open-Science SSH Compute…

@aipoch@aipochInstall Skill
customize

customize

Use when the user wants to create or manage a Specialist agent or create, revise, publish, or delete a Skill through the…

@aipoch@aipochInstall Skill

More skills from other plugins.

academic-paper-review

academic-paper-review

Use this skill when the user requests to review, analyze, critique, or summarize academic papers, research articles, preprints,…

@bytedance@bytedanceInstall Skill
last30days

last30days

Research what people actually say about any topic in the last 30 days. Pulls posts and engagement from Reddit, X, YouTube,…

@mvanhorn@mvanhornInstall Skill

Questions about pdf-generation.

Which coding agents can use pdf-generation?
pdf-generation installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.