# PDF

> Create polished PDF documents such as reports, letters, one-pagers, and printable summaries.

- Skill: `modsetter/pdf-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add modsetter/pdf-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/modsetter/pdf-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: MODSetter (https://skillmd.com/u/modsetter)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/modsetter/pdf-2

---


# PDF

Author the PDF with `reportlab`, then get its bytes. Prefer the Platypus
flowable API (`SimpleDocTemplate` over a `BytesIO`, with `Paragraph`, `Table`,
`Spacer`, and `getSampleStyleSheet`) over hand-placed canvas coordinates.

## Authoring rules

- Use A4 unless US Letter is implied. Use margins of at least 18 mm (0.7 in),
  10–11 pt body text, and 1.3–1.5 line height.
- Structure the document with a title, headings, justified body text, and
  tables built from `Table`/`TableStyle` where the data invites them.
- ReportLab's `Paragraph` parses a small XML markup, so escape `&`, `<`, and `>`
  in any source text (`xml.sax.saxutils.escape`) before placing it.
- The built-in fonts (Helvetica, Times) are Latin-1 only. For broader Unicode,
  register a TrueType font with `pdfmetrics.registerFont(TTFont(...))` if one is
  available; otherwise keep the text within Latin-1.
- Do not embed `Page X of Y` folios; the viewer supplies its own page indicator.
- Build to a `BytesIO` and read the bytes back; do not write a file to disk.

