[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GB4NF03W90WVZMDGMDFQJR":3,"skill-same:01M6GB4NF03W90WVZMDGMDFQJR":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":56,"repositoryHtmlUrl":57,"repositoryHomepageUrl":6,"ownerHtmlUrl":58,"ownerBlogUrl":6,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M6GB4NF03W90WVZMDGMDFQJR","pdf",null,"Create, read, merge, fill, and secure PDF files.","zapabob\u002FSkills","zapabob","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F130830376?v=4","01M6DBMYZAGRTFQDSQYW3W764P","峯岸 亮","01M6DBMZ3GKDSJ01NZ9XTZD7JD",2,"MIT","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Farchive\u002Fskill-md-reviewed\u002Fsha256\u002F94\u002F947e71440d0cdbaa4df717900d9e59e95762975b7a36930275312b589a23ceb9\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"PDF","pdfplumber","docx","nous research","forms","files","read","ocr","productivity","create","powerpoint","secure","documents","windows","merge","research","linux","macos","xlsx","2026-11-10 10:12:30",false,"---\nname: pdf\ndescription: Create, read, merge, fill, and secure PDF files.\nversion: 1.0.0\nauthor: Nous Research\nlicense: MIT\nplatforms: [linux, macos, windows]\nmetadata:\n  hermes:\n    tags: [pdf, documents, forms, reportlab, pypdf, pdfplumber]\n    category: productivity\n    related_skills: [docx, xlsx, powerpoint, ocr-and-documents]\n---\n\n# PDF Skill\n\nCreate PDFs from structured specs, build and fill AcroForm forms (with layout linting and visual overlays), extract text\u002Ftables\u002Fmetadata, merge\u002Fsplit\u002Frotate\u002Fwatermark\u002Fstamp pages, export page images, manage metadata and attachments, and encrypt\u002Fdecrypt — using pypdf, reportlab, and pdfplumber. Scanned (image-only) PDFs contain no text layer: OCR is explicitly out of scope here — when a page is image-only, stop and use the `ocr-and-documents` skill instead of pretending to extract text.\n\n## When to Use\n\n- Generate a report, invoice, or multi-page document as PDF.\n- Build a fillable AcroForm (text\u002Fcheckbox\u002Fradio\u002Fdropdown) from a JSON spec, linting the layout first.\n- Pull text, tables (JSON\u002FCSV), metadata, or form-field values out of a PDF.\n- Merge, split, rotate, extract page subsets, watermark, stamp text\u002Fimages at coordinates, bookmark, or compress PDFs.\n- Export pages as PNGs for visual review or for OCR hand-off; set\u002Fclear document metadata; add\u002Fextract file attachments.\n- Fill or flatten AcroForm forms; encrypt or decrypt with passwords.\n- NOT for scanned\u002Fimage-only PDFs (use `ocr-and-documents`) and NOT for pixel-perfect HTML-to-PDF rendering (use a headless browser).\n\n## Prerequisites\n\n- Python 3.10+ with `pypdf`, `reportlab`, `pdfplumber`:\n  `python3 -m pip install pypdf reportlab pdfplumber`\n- Optional, for page rasterization (`pdf_page_image.py`, overlay rendering): `python3 -m pip install pypdfium2`, or poppler's `pdftoppm` on PATH. Scripts fall back pypdfium2 → pdftoppm and report `{\"rendered\": false, \"missing\": [...]}` (exit 0) when neither exists.\n- Each helper script checks imports lazily and prints an install hint if a dependency is missing.\n\n## How to Run\n\nAll helpers live in `scripts\u002F` and are argparse CLIs — run them with the `terminal` tool; every one supports `--help`. They read\u002Fwrite JSON strictly as UTF-8, print JSON results to stdout, and exit non-zero on failure.\n\n```bash\npython3 scripts\u002Fpdf_create.py spec.json -o out.pdf         # build PDF from JSON spec\npython3 scripts\u002Fpdf_make_form.py formspec.json -o form.pdf # build fillable AcroForm from JSON spec\npython3 scripts\u002Fpdf_form_layout.py formspec.json           # lint form layout BEFORE building\npython3 scripts\u002Fpdf_form_layout.py formspec.json --render-overlay boxes.png [--pdf form.pdf]\npython3 scripts\u002Fpdf_read.py doc.pdf --text                 # per-page text (JSON)\npython3 scripts\u002Fpdf_read.py doc.pdf --tables --csv-dir t\u002F  # tables to JSON + CSV files\npython3 scripts\u002Fpdf_read.py doc.pdf --meta                 # metadata, page sizes, encrypted\u002Fscanned flags\npython3 scripts\u002Fpdf_read.py form.pdf --fields              # form fields: name, type, value\npython3 scripts\u002Fpdf_merge.py a.pdf b.pdf -o merged.pdf [--bookmarks]\npython3 scripts\u002Fpdf_split.py doc.pdf --pages 1-3,7 -o part.pdf [--rotate 90]\npython3 scripts\u002Fpdf_fill_form.py form.pdf --fields-json values.json -o filled.pdf [--flatten]\npython3 scripts\u002Fpdf_secure.py doc.pdf --encrypt -o enc.pdf --user-password your-password\npython3 scripts\u002Fpdf_secure.py enc.pdf --decrypt -o dec.pdf --password your-password\npython3 scripts\u002Fpdf_watermark.py doc.pdf --stamp mark.pdf -o stamped.pdf [--under]\npython3 scripts\u002Fpdf_stamp.py doc.pdf -o out.pdf --text \"DRAFT\" --x 150 --y 400 \\\n    --font-size 60 --rotation 45 --opacity 0.3 --color \"#cc0000\" [--pages 1-3]\npython3 scripts\u002Fpdf_stamp.py doc.pdf -o out.pdf --image sig.png --x 400 --y 60 --width 120\npython3 scripts\u002Fpdf_page_image.py doc.pdf --pages 1-3 --dpi 150 --out-dir imgs\u002F\npython3 scripts\u002Fpdf_meta.py doc.pdf --set-meta --title \"T\" --author \"A\" -o out.pdf\npython3 scripts\u002Fpdf_meta.py doc.pdf --attach data.csv -o out.pdf\npython3 scripts\u002Fpdf_meta.py doc.pdf --list-attachments | --extract-attachments dir\u002F\n```\n\n## Quick Reference\n\n| Task | Tool | Command \u002F API |\n|---|---|---|\n| Create doc (headings, tables, images) | reportlab platypus | `pdf_create.py spec.json -o out.pdf` |\n| Build fillable form | reportlab acroForm | `pdf_make_form.py formspec.json -o form.pdf` |\n| Lint form layout \u002F overlay image | pure python + PIL | `pdf_form_layout.py formspec.json [--render-overlay o.png]` |\n| Per-page text | pdfplumber | `pdf_read.py f.pdf --text` |\n| Tables → JSON\u002FCSV | pdfplumber | `pdf_read.py f.pdf --tables` |\n| Metadata \u002F sizes \u002F encrypted \u002F scanned | pypdf + pdfplumber | `pdf_read.py f.pdf --meta` |\n| Merge (+ outline) | pypdf | `pdf_merge.py a.pdf b.pdf -o m.pdf` |\n| Split \u002F extract \u002F rotate | pypdf | `pdf_split.py f.pdf --pages 2-5 --rotate 90` |\n| List \u002F fill \u002F flatten form | pypdf | `pdf_read.py --fields`, `pdf_fill_form.py` |\n| Encrypt \u002F decrypt (AES-256) | pypdf | `pdf_secure.py --encrypt\u002F--decrypt` |\n| Watermark \u002F stamp PDF page | pypdf | `pdf_watermark.py f.pdf --stamp w.pdf` |\n| Stamp text\u002Fimage at coordinates | reportlab + pypdf | `pdf_stamp.py f.pdf --text \"Sign here\" --x 400 --y 60` |\n| Pages → PNG (review \u002F OCR hand-off) | pypdfium2 or pdftoppm | `pdf_page_image.py f.pdf --pages 1-3 --out-dir imgs\u002F` |\n| Set\u002Fclear metadata, attachments | pypdf | `pdf_meta.py --set-meta \u002F --attach \u002F --extract-attachments` |\n| Compress content streams | pypdf | `pdf_split.py f.pdf --pages 1-N --compress` |\n\n## Procedure\n\n1. **Inspect first.** Run `pdf_read.py file.pdf --meta`. Check `encrypted` (if true, decrypt first with `pdf_secure.py --decrypt`) and `likely_scanned_pages`. If pages are image-only, export them with `pdf_page_image.py --pages \u003Cscanned> --dpi 300 --out-dir imgs\u002F` and hand the PNGs to the `ocr-and-documents` skill — do not report empty text as \"no content\".\n2. **Create.** Write a JSON spec with `write_file` (elements: `heading`, `paragraph`, `table`, `image`, `pagebreak`; optional `title`\u002F`author` metadata; page numbers are added automatically), then run `pdf_create.py`. Verify visually with `vision_analyze` on a rendered page image if layout matters.\n3. **Extract.** `--text` gives a JSON list of per-page strings; `--tables` gives row arrays per page and can also emit CSV files. Read results with `read_file`; never eyeball a binary PDF directly.\n4. **Manipulate.** `pdf_merge.py` concatenates and can add one bookmark per source file; `pdf_split.py` handles page ranges (1-based, e.g. `1-3,5,9-`), rotation in 90° steps, and `--compress`. Watermark by preparing a single-page stamp PDF (e.g. via `pdf_create.py`) and overlaying it with `pdf_watermark.py`; for one-liner stamps (\"sign here\", diagonal DRAFT, corner labels) use `pdf_stamp.py` with text or an image at explicit coordinates.\n5. **Build forms.** Write one form-spec JSON (fields with `label_box`\u002F`entry_box` in PDF points — see `references\u002Fforms.md`), lint it with `pdf_form_layout.py` and fix every reported problem, optionally review the `--render-overlay` PNG with `vision_analyze`, then build with `pdf_make_form.py` and confirm with `pdf_read.py --fields`.\n6. **Fill forms.** List fields (`--fields`) to learn exact names and types, write a UTF-8 JSON of `{\"FieldName\": \"value\"}` with `write_file` (checkboxes accept `true`\u002F`false`; radio\u002Fchoice values must match the field's export options), then `pdf_fill_form.py`. Re-read with `--fields` to confirm values landed.\n7. **Metadata & attachments.** `pdf_meta.py --set-meta` writes Title\u002FAuthor\u002FSubject\u002FKeywords (DocInfo); `--clear-meta` drops them; `--attach`\u002F`--list-attachments`\u002F`--extract-attachments` round-trip embedded files.\n8. **Secure.** Encrypt with distinct user\u002Fowner passwords and AES-256. To remove a password you know, `--decrypt` writes an unencrypted copy.\n9. **Verify** (see below) before reporting success.\n\n## Pitfalls\n\n- **Scanned PDFs**: empty `extract_text()` plus page images means there is no text layer. Route to `ocr-and-documents`; do not fabricate text.\n- **Flattening limits**: `pdf_fill_form.py --flatten` uses pypdf's flatten support, which converts widget appearances into page content. It is reliable for plain text fields and checkboxes but can drop or misrender exotic widgets (rich text, custom appearance streams, some radio groups). Verify the flattened output visually with `vision_analyze`; for bulletproof flattening use an external renderer (e.g. Ghostscript or `pdftoppm`+reassembly) as a fallback.\n- **NeedAppearances**: after filling, viewers only render values if appearance streams exist. The fill script sets the AcroForm `NeedAppearances` flag so conforming viewers regenerate them; some minimal viewers ignore it — flatten if display fidelity matters.\n- **Non-Latin form values**: values are stored correctly (UTF-16), but the field's default font may lack glyphs, so a viewer can show blanks even though the data round-trips. Verify with `--fields`, not just visually.\n- **Compression expectations**: `--compress` only deflates content streams. Typical savings are 0–20%; it does nothing for PDFs dominated by images or already-compressed streams. It is not a substitute for image downsampling (Ghostscript territory).\n- **Permission flags don't enforce**: owner-password permission bits (no-print, no-copy) are polite requests that viewers may honor; any library (including pypdf) can read and strip them. Only the user password actually gates content via encryption. Never present permission flags as security.\n- **Table extraction is heuristic**: pdfplumber detects tables from ruling lines\u002Fword alignment; borderless or merged-cell tables may need `table_settings` tuning or manual cleanup.\n- **Page indexing**: helper CLIs take 1-based pages; pypdf APIs are 0-based. The scripts convert — don't double-convert.\n- **Rotated stamp text extraction**: pdfplumber's line grouping scrambles rotated glyphs (a 45° \"DRAFT\" extracts as stray letters); verify rotated stamps with `pypdf`'s `extract_text()` or a rendered image instead.\n- **Radio groups**: reportlab needs ≥2 `radio()` widgets per group, fills need the slashed export value (`\"\u002Fred\"`), and flatten fidelity is worst for radios — see `references\u002Fforms.md`.\n- **Metadata scope**: `pdf_meta.py` writes the classic DocInfo dictionary only; embedded XMP metadata (if any) is left untouched and may show different values in some viewers.\n- **PDF\u002FA is out of scope**: pypdf\u002Freportlab cannot produce or validate conformant PDF\u002FA. If archival conformance is required, run Ghostscript via the `terminal` tool (e.g. `gs -dPDFA=2 -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=UseDeviceIndependentColor -sDEVICE=pdfwrite -o out.pdf in.pdf` with a suitable ICC profile) and validate with veraPDF — both are external installs, and the result still needs validation, not assumption.\n- Rotation must be a multiple of 90; encrypted inputs must be decrypted before any other operation.\n\n## Verification\n\n- After create\u002Fmerge\u002Fsplit: `pdf_read.py out.pdf --meta` — confirm `page_count`, and per-page `rotation` when you rotated.\n- After extraction: check the JSON is non-empty and spot-check a known string or cell.\n- Form design loop: `pdf_form_layout.py spec.json` must exit 0; then `--render-overlay boxes.png --pdf form.pdf` and review the PNG with `vision_analyze` (red = entry boxes with field names, blue = label boxes) asking about overlaps, misalignment, and labels detached from their fields. Iterate spec → lint → overlay until clean.\n- After building a form: `pdf_read.py form.pdf --fields` lists every spec field with the right type and options.\n- After form fill: `pdf_read.py filled.pdf --fields` and compare values (exact match, including non-ASCII).\n- After stamping: re-extract text (pypdf for rotated stamps) or render the page with `pdf_page_image.py` and inspect with `vision_analyze`.\n- After metadata\u002Fattachment edits: `pdf_read.py --meta` \u002F `pdf_meta.py --list-attachments`, and re-extract an attachment to byte-compare.\n- After encrypt: `--meta` shows `\"encrypted\": true` and opening without a password fails; after decrypt, text extraction matches the original.\n- For anything visual (watermarks, flattened forms), render and inspect with `vision_analyze`.\n","# PDF Skill\n\nCreate PDFs from structured specs, build and fill AcroForm forms (with layout linting and visual overlays), extract text\u002Ftables\u002Fmetadata, merge\u002Fsplit\u002Frotate\u002Fwatermark\u002Fstamp pages, export page images, manage metadata and attachments, and encrypt\u002Fdecrypt — using pypdf, reportlab, and pdfplumber. Scanned (image-only) PDFs contain no text layer: OCR is explicitly out of scope here — when a page is image-only, stop and use the `ocr-and-documents` skill instead of pretending to extract text.\n\n## When to Use\n\n- Generate a report, invoice, or multi-page document as PDF.\n- Build a fillable AcroForm (text\u002Fcheckbox\u002Fradio\u002Fdropdown) from a JSON spec, linting the layout first.\n- Pull text, tables (JSON\u002FCSV), metadata, or form-field values out of a PDF.\n- Merge, split, rotate, extract page subsets, watermark, stamp text\u002Fimages at coordinates, bookmark, or compress PDFs.\n- Export pages as PNGs for visual review or for OCR hand-off; set\u002Fclear document metadata; add\u002Fextract file attachments.\n- Fill or flatten AcroForm forms; encrypt or decrypt with passwords.\n- NOT for scanned\u002Fimage-only PDFs (use `ocr-and-documents`) and NOT for pixel-perfect HTML-to-PDF rendering (use a headless browser).\n\n## Prerequisites\n\n- Python 3.10+ with `pypdf`, `reportlab`, `pdfplumber`:\n  `python3 -m pip install pypdf reportlab pdfplumber`\n- Optional, for page rasterization (`pdf_page_image.py`, overlay rendering): `python3 -m pip install pypdfium2`, or poppler's `pdftoppm` on PATH. Scripts fall back pypdfium2 → pdftoppm and report `{\"rendered\": false, \"missing\": [...]}` (exit 0) when neither exists.\n- Each helper script checks imports lazily and prints an install hint if a dependency is missing.\n\n## How to Run\n\nAll helpers live in `scripts\u002F` and are argparse CLIs — run them with the `terminal` tool; every one supports `--help`. They read\u002Fwrite JSON strictly as UTF-8, print JSON results to stdout, and exit non-zero on failure.\n\n```bash\npython3 scripts\u002Fpdf_create.py spec.json -o out.pdf         # build PDF from JSON spec\npython3 scripts\u002Fpdf_make_form.py formspec.json -o form.pdf # build fillable AcroForm from JSON spec\npython3 scripts\u002Fpdf_form_layout.py formspec.json           # lint form layout BEFORE building\npython3 scripts\u002Fpdf_form_layout.py formspec.json --render-overlay boxes.png [--pdf form.pdf]\npython3 scripts\u002Fpdf_read.py doc.pdf --text                 # per-page text (JSON)\npython3 scripts\u002Fpdf_read.py doc.pdf --tables --csv-dir t\u002F  # tables to JSON + CSV files\npython3 scripts\u002Fpdf_read.py doc.pdf --meta                 # metadata, page sizes, encrypted\u002Fscanned flags\npython3 scripts\u002Fpdf_read.py form.pdf --fields              # form fields: name, type, value\npython3 scripts\u002Fpdf_merge.py a.pdf b.pdf -o merged.pdf [--bookmarks]\npython3 scripts\u002Fpdf_split.py doc.pdf --pages 1-3,7 -o part.pdf [--rotate 90]\npython3 scripts\u002Fpdf_fill_form.py form.pdf --fields-json values.json -o filled.pdf [--flatten]\npython3 scripts\u002Fpdf_secure.py doc.pdf --encrypt -o enc.pdf --user-password your-password\npython3 scripts\u002Fpdf_secure.py enc.pdf --decrypt -o dec.pdf --password your-password\npython3 scripts\u002Fpdf_watermark.py doc.pdf --stamp mark.pdf -o stamped.pdf [--under]\npython3 scripts\u002Fpdf_stamp.py doc.pdf -o out.pdf --text \"DRAFT\" --x 150 --y 400 \\\n    --font-size 60 --rotation 45 --opacity 0.3 --color \"#cc0000\" [--pages 1-3]\npython3 scripts\u002Fpdf_stamp.py doc.pdf -o out.pdf --image sig.png --x 400 --y 60 --width 120\npython3 scripts\u002Fpdf_page_image.py doc.pdf --pages 1-3 --dpi 150 --out-dir imgs\u002F\npython3 scripts\u002Fpdf_meta.py doc.pdf --set-meta --title \"T\" --author \"A\" -o out.pdf\npython3 scripts\u002Fpdf_meta.py doc.pdf --attach data.csv -o out.pdf\npython3 scripts\u002Fpdf_meta.py doc.pdf --list-attachments | --extract-attachments dir\u002F\n```\n\n## Quick Reference\n\n| Task | Tool | Command \u002F API |\n|---|---|---|\n| Create doc (headings, tables, images) | reportlab platypus | `pdf_create.py spec.json -o out.pdf` |\n| Build fillable form | reportlab acroForm | `pdf_make_form.py formspec.json -o form.pdf` |\n| Lint form layout \u002F overlay image | pure python + PIL | `pdf_form_layout.py formspec.json [--render-overlay o.png]` |\n| Per-page text | pdfplumber | `pdf_read.py f.pdf --text` |\n| Tables → JSON\u002FCSV | pdfplumber | `pdf_read.py f.pdf --tables` |\n| Metadata \u002F sizes \u002F encrypted \u002F scanned | pypdf + pdfplumber | `pdf_read.py f.pdf --meta` |\n| Merge (+ outline) | pypdf | `pdf_merge.py a.pdf b.pdf -o m.pdf` |\n| Split \u002F extract \u002F rotate | pypdf | `pdf_split.py f.pdf --pages 2-5 --rotate 90` |\n| List \u002F fill \u002F flatten form | pypdf | `pdf_read.py --fields`, `pdf_fill_form.py` |\n| Encrypt \u002F decrypt (AES-256) | pypdf | `pdf_secure.py --encrypt\u002F--decrypt` |\n| Watermark \u002F stamp PDF page | pypdf | `pdf_watermark.py f.pdf --stamp w.pdf` |\n| Stamp text\u002Fimage at coordinates | reportlab + pypdf | `pdf_stamp.py f.pdf --text \"Sign here\" --x 400 --y 60` |\n| Pages → PNG (review \u002F OCR hand-off) | pypdfium2 or pdftoppm | `pdf_page_image.py f.pdf --pages 1-3 --out-dir imgs\u002F` |\n| Set\u002Fclear metadata, attachments | pypdf | `pdf_meta.py --set-meta \u002F --attach \u002F --extract-attachments` |\n| Compress content streams | pypdf | `pdf_split.py f.pdf --pages 1-N --compress` |\n\n## Procedure\n\n1. **Inspect first.** Run `pdf_read.py file.pdf --meta`. Check `encrypted` (if true, decrypt first with `pdf_secure.py --decrypt`) and `likely_scanned_pages`. If pages are image-only, export them with `pdf_page_image.py --pages \u003Cscanned> --dpi 300 --out-dir imgs\u002F` and hand the PNGs to the `ocr-and-documents` skill — do not report empty text as \"no content\".\n2. **Create.** Write a JSON spec with `write_file` (elements: `heading`, `paragraph`, `table`, `image`, `pagebreak`; optional `title`\u002F`author` metadata; page numbers are added automatically), then run `pdf_create.py`. Verify visually with `vision_analyze` on a rendered page image if layout matters.\n3. **Extract.** `--text` gives a JSON list of per-page strings; `--tables` gives row arrays per page and can also emit CSV files. Read results with `read_file`; never eyeball a binary PDF directly.\n4. **Manipulate.** `pdf_merge.py` concatenates and can add one bookmark per source file; `pdf_split.py` handles page ranges (1-based, e.g. `1-3,5,9-`), rotation in 90° steps, and `--compress`. Watermark by preparing a single-page stamp PDF (e.g. via `pdf_create.py`) and overlaying it with `pdf_watermark.py`; for one-liner stamps (\"sign here\", diagonal DRAFT, corner labels) use `pdf_stamp.py` with text or an image at explicit coordinates.\n5. **Build forms.** Write one form-spec JSON (fields with `label_box`\u002F`entry_box` in PDF points — see `references\u002Fforms.md`), lint it with `pdf_form_layout.py` and fix every reported problem, optionally review the `--render-overlay` PNG with `vision_analyze`, then build with `pdf_make_form.py` and confirm with `pdf_read.py --fields`.\n6. **Fill forms.** List fields (`--fields`) to learn exact names and types, write a UTF-8 JSON of `{\"FieldName\": \"value\"}` with `write_file` (checkboxes accept `true`\u002F`false`; radio\u002Fchoice values must match the field's export options), then `pdf_fill_form.py`. Re-read with `--fields` to confirm values landed.\n7. **Metadata & attachments.** `pdf_meta.py --set-meta` writes Title\u002FAuthor\u002FSubject\u002FKeywords (DocInfo); `--clear-meta` drops them; `--attach`\u002F`--list-attachments`\u002F`--extract-attachments` round-trip embedded files.\n8. **Secure.** Encrypt with distinct user\u002Fowner passwords and AES-256. To remove a password you know, `--decrypt` writes an unencrypted copy.\n9. **Verify** (see below) before reporting success.\n\n## Pitfalls\n\n- **Scanned PDFs**: empty `extract_text()` plus page images means there is no text layer. Route to `ocr-and-documents`; do not fabricate text.\n- **Flattening limits**: `pdf_fill_form.py --flatten` uses pypdf's flatten support, which converts widget appearances into page content. It is reliable for plain text fields and checkboxes but can drop or misrender exotic widgets (rich text, custom appearance streams, some radio groups). Verify the flattened output visually with `vision_analyze`; for bulletproof flattening use an external renderer (e.g. Ghostscript or `pdftoppm`+reassembly) as a fallback.\n- **NeedAppearances**: after filling, viewers only render values if appearance streams exist. The fill script sets the AcroForm `NeedAppearances` flag so conforming viewers regenerate them; some minimal viewers ignore it — flatten if display fidelity matters.\n- **Non-Latin form values**: values are stored correctly (UTF-16), but the field's default font may lack glyphs, so a viewer can show blanks even though the data round-trips. Verify with `--fields`, not just visually.\n- **Compression expectations**: `--compress` only deflates content streams. Typical savings are 0–20%; it does nothing for PDFs dominated by images or already-compressed streams. It is not a substitute for image downsampling (Ghostscript territory).\n- **Permission flags don't enforce**: owner-password permission bits (no-print, no-copy) are polite requests that viewers may honor; any library (including pypdf) can read and strip them. Only the user password actually gates content via encryption. Never present permission flags as security.\n- **Table extraction is heuristic**: pdfplumber detects tables from ruling lines\u002Fword alignment; borderless or merged-cell tables may need `table_settings` tuning or manual cleanup.\n- **Page indexing**: helper CLIs take 1-based pages; pypdf APIs are 0-based. The scripts convert — don't double-convert.\n- **Rotated stamp text extraction**: pdfplumber's line grouping scrambles rotated glyphs (a 45° \"DRAFT\" extracts as stray letters); verify rotated stamps with `pypdf`'s `extract_text()` or a rendered image instead.\n- **Radio groups**: reportlab needs ≥2 `radio()` widgets per group, fills need the slashed export value (`\"\u002Fred\"`), and flatten fidelity is worst for radios — see `references\u002Fforms.md`.\n- **Metadata scope**: `pdf_meta.py` writes the classic DocInfo dictionary only; embedded XMP metadata (if any) is left untouched and may show different values in some viewers.\n- **PDF\u002FA is out of scope**: pypdf\u002Freportlab cannot produce or validate conformant PDF\u002FA. If archival conformance is required, run Ghostscript via the `terminal` tool (e.g. `gs -dPDFA=2 -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=UseDeviceIndependentColor -sDEVICE=pdfwrite -o out.pdf in.pdf` with a suitable ICC profile) and validate with veraPDF — both are external installs, and the result still needs validation, not assumption.\n- Rotation must be a multiple of 90; encrypted inputs must be decrypted before any other operation.\n\n## Verification\n\n- After create\u002Fmerge\u002Fsplit: `pdf_read.py out.pdf --meta` — confirm `page_count`, and per-page `rotation` when you rotated.\n- After extraction: check the JSON is non-empty and spot-check a known string or cell.\n- Form design loop: `pdf_form_layout.py spec.json` must exit 0; then `--render-overlay boxes.png --pdf form.pdf` and review the PNG with `vision_analyze` (red = entry boxes with field names, blue = label boxes) asking about overlaps, misalignment, and labels detached from their fields. Iterate spec → lint → overlay until clean.\n- After building a form: `pdf_read.py form.pdf --fields` lists every spec field with the right type and options.\n- After form fill: `pdf_read.py filled.pdf --fields` and compare values (exact match, including non-ASCII).\n- After stamping: re-extract text (pypdf for rotated stamps) or render the page with `pdf_page_image.py` and inspect with `vision_analyze`.\n- After metadata\u002Fattachment edits: `pdf_read.py --meta` \u002F `pdf_meta.py --list-attachments`, and re-extract an attachment to byte-compare.\n- After encrypt: `--meta` shows `\"encrypted\": true` and opening without a password fails; after decrypt, text extraction matches the original.\n- For anything visual (watermarks, flattened forms), render and inspect with `vision_analyze`.\n",{"name":5,"author":43,"license":15,"version":44,"metadata":45,"platforms":52,"description":7},"Nous Research","1.0.0",{"hermes":46},{"tags":47,"category":27,"related_skills":50},[5,31,23,48,49,20],"reportlab","pypdf",[21,37,29,51],"ocr-and-documents",[35,36,32],"main","0d1434f89f4bc6b07e9d272accd8c1013768820f","archive\u002Fskill-md-reviewed\u002Fsha256\u002F94\u002F947e71440d0cdbaa4df717900d9e59e95762975b7a36930275312b589a23ceb9",0,"https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills","https:\u002F\u002Fgithub.com\u002Fzapabob","The Open University of JAPAN　2019-now\r\n\r\nTokyo University of Science　2007-2010","2026-10-26 16:29:01",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add zapabob\u002FSkills --skill pdf",{"tool":67,"command":68},"bunx","bunx skills add zapabob\u002FSkills --skill pdf",{"tool":70,"command":71},"pnpm","pnpm dlx skills add zapabob\u002FSkills --skill pdf","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Farchive\u002Fskill-md-reviewed\u002Fsha256\u002F94\u002F947e71440d0cdbaa4df717900d9e59e95762975b7a36930275312b589a23ceb9\u002FSKILL.md",true,[],[76,98,122,146,170,186],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":38},"01M6GJTE1GESGGF9K028Y7753E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fxurl\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[],[78,83,36,84,85,35,32,86,87,88,89,90,91,92,93,94,53,95,96,97],"openclaw","cli","github","official","search","https","social-media","api","Media","hermes","hermes agent","twitter","social","via","post",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":38},"01M6GJT8S1PXQ8WPXT1HSNBWH2","writing-plans","Write implementation plans: bite-sized tasks, paths, code.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwriting-plans\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[],[105,106,107,108,36,109,35,110,32,111,112,113,114,115,116,117,118,119,120,121],"writing","writing plans","plans","design","review","workflow","documentation","tasks","development","code","planning","code-review","subagent","write","superpowers","paths","test-driven-development",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":38},"01M6GJST0H5X7WHBJ3BZK0DVKH","whisper","OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwhisper\u002Fvariants\u002Fhermes-agent-optional\u002FSKILL.md",[],[124,36,35,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145],"openai","speech","multimodal","Transformers","ASR","Audio","text","model","speech recognition","use","general","multilingual","translation","english","identification","processing","Audio Processing",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":38},"01M6GJSMRQ8EETZTYMG72P70EA","weights-and-biases","W&B: log ML experiments, sweeps, model registry, dashboards.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fweights-and-biases\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[],[153,36,154,155,32,156,157,158,159,160,161,136,162,163,164,165,166,167,168,169],"weights and biases","tensorflow","experiments","pytorch","visualization","registry","real-time","tuning","dashboards","experiment","log","time","Experiment Tracking","Model Registry","Hyperparameter Tuning","WandB","Real-Time Visualization",{"skillNo":171,"name":172,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":38},"01M6GJS19KDPRY112JTR326S06","watchers","Poll RSS, JSON APIs, and GitHub with watermark dedup.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwatchers\u002Fvariants\u002Fhermes-agent-optional\u002FSKILL.md",[],[172,36,177,85,35,178,179,180,181,182,183,92,93,184,185],"terminal","automation","http","monitoring","cron","json","rss","devops","with",{"skillNo":187,"name":188,"nameZh":6,"description":189,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":190,"categories":191,"keywords":192,"publishedAt":38},"01M6GJRHJD2A6Q830SWF9W48BC","serving-llms-vllm","vLLM: high-throughput LLM serving, OpenAI API, quantization.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fvllm\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[],[193,194,195,35,34,129,196,197,198,132,199,90,200,201,202,203,204,205,206,207],"llms","vLLM","serving llms vllm","openai api","tensor","Inference Serving","Production","llm serving","High Throughput","PagedAttention","Continuous Batching","Quantization","Tensor Parallelism","high-throughput","throughput"]