# Book PDF

> Generate and verify a polished PDF containing the full current manuscript of a book in book.db, with title page, ordered parts and chapters, page numbers, metadata, word count, and included text-version IDs. Use for PDF, print copy, reading copy, export book, full manuscript, or compile current version requests. Do not use to edit or approve prose.

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

---


# Book PDF

Create a disposable, reproducible reading snapshot from the authoritative current manuscript in `book.db`. Never edit manuscript prose merely to improve the export.

Use the bundled deterministic helper (path shown for Claude Code; under Codex the same file resolves at `.agents/skills/book-pdf/scripts/export_book_pdf.py` via a symlink to `.claude/skills`):

```bash
python .claude/skills/book-pdf/scripts/export_book_pdf.py \
  --db book.db \
  --book book.01 \
  --out exports/book-01-current.pdf
```

The script requires Python and ReportLab. Prefer an existing installation. If ReportLab is absent and environment policy permits package installation, install only that dependency in the active environment; do not add an application framework or permanent build system.

## Select the book

Use the book named by the human. Otherwise:

1. select the only active book containing current manuscript text;
2. when several qualify, use the one with the most recently edited manuscript and report the choice;
3. when no manuscript exists, explain that there is nothing to export and identify the nearest draftable unit.

Use `--list` to inspect exportable books:

```bash
python .claude/skills/book-pdf/scripts/export_book_pdf.py --db book.db --list
```

## Export rules

- Export current `manuscript` versions, whether draft or approved, because the request is for the current book snapshot.
- Preserve tree order.
- Use book, part, and chapter headings.
- Prefer the smallest current manuscript units and avoid duplicating aggregate chapter/book text when descendant units already contain manuscript text.
- Omit rejected and archived nodes.
- Insert clean scene breaks without exposing internal scene codes.
- Include a title page, author when available, readable typography, sensible page margins, and page numbers.
- Put the output under `exports/` unless the human specifies another path.
- Do not write export-only edits back into `book.db`.

Optional flags:

```text
--author "Author Name"
--page-size 6x9|a5|letter
--show-scene-titles
--approved-only
```

## Verification loop

After generation:

1. Confirm the script returned `status: ok`, a nonzero word count, and the included text-version IDs expected for the book.
2. Inspect PDF metadata and page count with `pdfinfo` or `pypdf` when available.
3. Render at least the first manuscript page, one middle page, and the final page using `pdftoppm`, PyMuPDF, or another available renderer.
4. Inspect the renders for clipped text, blank pages, broken glyphs, repeated content, missing chapters, bad scene breaks, and page-number collisions.
5. Correct export code or formatting and regenerate if verification fails. Do not alter prose to hide an exporter defect.
6. Remove temporary render files from the deliverable directory; leave the final PDF.

For a very short manuscript, inspect every page. For a full novel, also spot-check every chapter opening.

## Report

Return:

- the PDF path;
- selected book code/title;
- page and word counts;
- included text-version IDs;
- whether the snapshot includes draft material;
- any missing front matter or metadata that did not block export.

## Definition of done

A readable PDF exists at the requested path, its contents match the current ordered manuscript without duplication, representative pages have been visually verified, and the human knows exactly which versions were included.


