[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EWGJSVGG7G5KSFAD30MVCH":3,"skill-same:01M7EWGJSVGG7G5KSFAD30MVCH":154},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":6,"ownerHtmlUrl":53,"ownerBlogUrl":6,"ownerDescription":54,"updatedAt":55,"install":56,"resources":69},"01M7EWGJSVGG7G5KSFAD30MVCH","pdf",null,"PDF files: create, read, merge, fill, OCR, edit text.","vallenmulia99\u002Fvallenatrix","vallenmulia99","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F198408142?v=4","01M7EW918D10KEM1PWF6YEAR0R","Vallen Project","01M7EW918ZCWF720ZH8EW1GSSS",1,"MIT","https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: pdf\ndescription: \"PDF files: create, read, merge, fill, OCR, edit text.\"\nversion: 1.1.0\nauthor: Nous Research\nlicense: MIT\nplatforms: [linux, macos, windows]\nmetadata:\n  hermes:\n    tags: [pdf, documents, forms, ocr, text-extraction, reportlab, pypdf, pdfplumber, pymupdf, marker]\n    category: productivity\n    related_skills: [docx, xlsx, powerpoint]\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. Two absorbed capabilities live in references\u002F (read the matching file before those tasks):\n\n- **Scanned\u002Fimage-only PDFs and OCR** (pymupdf fast path, marker-pdf quality path, scripts\u002Fextract_pymupdf.py + scripts\u002Fextract_marker.py): `references\u002Focr-extraction.md`\n- **Editing text inside an existing PDF via natural-language prompts** (nano-pdf CLI): `references\u002Fnano-pdf-editing.md`\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 `references\u002Focr-extraction.md`) 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  `python -m pip install pypdf reportlab pdfplumber`\n- Optional, for page rasterization (`pdf_page_image.py`, overlay rendering): `python -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\npython scripts\u002Fpdf_create.py spec.json -o out.pdf         # build PDF from JSON spec\npython scripts\u002Fpdf_make_form.py formspec.json -o form.pdf # build fillable AcroForm from JSON spec\npython scripts\u002Fpdf_form_layout.py formspec.json           # lint form layout BEFORE building\npython scripts\u002Fpdf_form_layout.py formspec.json --render-overlay boxes.png [--pdf form.pdf]\npython scripts\u002Fpdf_read.py doc.pdf --text                 # per-page text (JSON)\npython scripts\u002Fpdf_read.py doc.pdf --tables --csv-dir t\u002F  # tables to JSON + CSV files\npython scripts\u002Fpdf_read.py doc.pdf --meta                 # metadata, page sizes, encrypted\u002Fscanned flags\npython scripts\u002Fpdf_read.py form.pdf --fields              # form fields: name, type, value\npython scripts\u002Fpdf_merge.py a.pdf b.pdf -o merged.pdf [--bookmarks]\npython scripts\u002Fpdf_split.py doc.pdf --pages 1-3,7 -o part.pdf [--rotate 90]\npython scripts\u002Fpdf_fill_form.py form.pdf --fields-json values.json -o filled.pdf [--flatten]\npython scripts\u002Fpdf_secure.py doc.pdf --encrypt -o enc.pdf --user-password your-password\npython scripts\u002Fpdf_secure.py enc.pdf --decrypt -o dec.pdf --password your-password\npython scripts\u002Fpdf_watermark.py doc.pdf --stamp mark.pdf -o stamped.pdf [--under]\npython 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]\npython scripts\u002Fpdf_stamp.py doc.pdf -o out.pdf --image sig.png --x 400 --y 60 --width 120\npython scripts\u002Fpdf_page_image.py doc.pdf --pages 1-3 --dpi 150 --out-dir imgs\u002F\npython scripts\u002Fpdf_meta.py doc.pdf --set-meta --title \"T\" --author \"A\" -o out.pdf\npython scripts\u002Fpdf_meta.py doc.pdf --attach data.csv -o out.pdf\npython 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 `references\u002Focr-extraction.md` 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 `references\u002Focr-extraction.md`; 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. Two absorbed capabilities live in references\u002F (read the matching file before those tasks):\n\n- **Scanned\u002Fimage-only PDFs and OCR** (pymupdf fast path, marker-pdf quality path, scripts\u002Fextract_pymupdf.py + scripts\u002Fextract_marker.py): `references\u002Focr-extraction.md`\n- **Editing text inside an existing PDF via natural-language prompts** (nano-pdf CLI): `references\u002Fnano-pdf-editing.md`\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 `references\u002Focr-extraction.md`) 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  `python -m pip install pypdf reportlab pdfplumber`\n- Optional, for page rasterization (`pdf_page_image.py`, overlay rendering): `python -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\npython scripts\u002Fpdf_create.py spec.json -o out.pdf         # build PDF from JSON spec\npython scripts\u002Fpdf_make_form.py formspec.json -o form.pdf # build fillable AcroForm from JSON spec\npython scripts\u002Fpdf_form_layout.py formspec.json           # lint form layout BEFORE building\npython scripts\u002Fpdf_form_layout.py formspec.json --render-overlay boxes.png [--pdf form.pdf]\npython scripts\u002Fpdf_read.py doc.pdf --text                 # per-page text (JSON)\npython scripts\u002Fpdf_read.py doc.pdf --tables --csv-dir t\u002F  # tables to JSON + CSV files\npython scripts\u002Fpdf_read.py doc.pdf --meta                 # metadata, page sizes, encrypted\u002Fscanned flags\npython scripts\u002Fpdf_read.py form.pdf --fields              # form fields: name, type, value\npython scripts\u002Fpdf_merge.py a.pdf b.pdf -o merged.pdf [--bookmarks]\npython scripts\u002Fpdf_split.py doc.pdf --pages 1-3,7 -o part.pdf [--rotate 90]\npython scripts\u002Fpdf_fill_form.py form.pdf --fields-json values.json -o filled.pdf [--flatten]\npython scripts\u002Fpdf_secure.py doc.pdf --encrypt -o enc.pdf --user-password your-password\npython scripts\u002Fpdf_secure.py enc.pdf --decrypt -o dec.pdf --password your-password\npython scripts\u002Fpdf_watermark.py doc.pdf --stamp mark.pdf -o stamped.pdf [--under]\npython 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]\npython scripts\u002Fpdf_stamp.py doc.pdf -o out.pdf --image sig.png --x 400 --y 60 --width 120\npython scripts\u002Fpdf_page_image.py doc.pdf --pages 1-3 --dpi 150 --out-dir imgs\u002F\npython scripts\u002Fpdf_meta.py doc.pdf --set-meta --title \"T\" --author \"A\" -o out.pdf\npython scripts\u002Fpdf_meta.py doc.pdf --attach data.csv -o out.pdf\npython 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 `references\u002Focr-extraction.md` 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 `references\u002Focr-extraction.md`; 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":25,"license":15,"version":26,"metadata":27,"platforms":44,"description":7},"Nous Research","1.1.0",{"hermes":28},{"tags":29,"category":39,"related_skills":40},[5,30,31,32,33,34,35,36,37,38],"documents","forms","ocr","text-extraction","reportlab","pypdf","pdfplumber","pymupdf","marker","productivity",[41,42,43],"docx","xlsx","powerpoint",[45,46,47],"linux","macos","windows","main","1f94be184060028b2b6001ca5c0b20e67d7c46a4",".vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf",0,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix","https:\u002F\u002Fgithub.com\u002Fvallenmulia99","Project⚡ Developer who loves building systems\r\n💻 C++ • JS • Android • Backend • Pyton\r\n🚀 Turning ideas into reality","2026-10-26 21:03:01",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add vallenmulia99\u002Fvallenatrix --skill pdf",{"tool":62,"command":63},"bunx","bunx skills add vallenmulia99\u002Fvallenatrix --skill pdf",{"tool":65,"command":66},"pnpm","pnpm dlx skills add vallenmulia99\u002Fvallenatrix --skill pdf","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002FSKILL.md",true,[70,74,80,84,88,94,98,102,106,110,114,118,122,126,130,134,138,142,146,150],{"path":71,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":16},"LICENSE","许可证",1070,{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fforms.md","REFERENCE","参考文档",3950,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Freferences\u002Fforms.md",{"path":81,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fnano-pdf-editing.md",1342,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Freferences\u002Fnano-pdf-editing.md",{"path":85,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Focr-extraction.md",5615,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Freferences\u002Focr-extraction.md",{"path":89,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":92,"sourceHtmlUrl":93},"scripts\u002F_raster.py","SCRIPT","脚本",2614,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002F_raster.py",{"path":95,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":96,"sourceHtmlUrl":97},"scripts\u002Fextract_marker.py",3458,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fextract_marker.py",{"path":99,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":100,"sourceHtmlUrl":101},"scripts\u002Fextract_pymupdf.py",3671,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fextract_pymupdf.py",{"path":103,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":104,"sourceHtmlUrl":105},"scripts\u002Fpdf_create.py",4562,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_create.py",{"path":107,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":108,"sourceHtmlUrl":109},"scripts\u002Fpdf_fill_form.py",3887,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_fill_form.py",{"path":111,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":112,"sourceHtmlUrl":113},"scripts\u002Fpdf_form_layout.py",7131,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_form_layout.py",{"path":115,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":116,"sourceHtmlUrl":117},"scripts\u002Fpdf_make_form.py",5988,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_make_form.py",{"path":119,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":120,"sourceHtmlUrl":121},"scripts\u002Fpdf_merge.py",1686,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_merge.py",{"path":123,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":124,"sourceHtmlUrl":125},"scripts\u002Fpdf_meta.py",4458,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_meta.py",{"path":127,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":128,"sourceHtmlUrl":129},"scripts\u002Fpdf_page_image.py",3589,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_page_image.py",{"path":131,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":132,"sourceHtmlUrl":133},"scripts\u002Fpdf_read.py",5895,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_read.py",{"path":135,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":136,"sourceHtmlUrl":137},"scripts\u002Fpdf_secure.py",2679,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_secure.py",{"path":139,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":140,"sourceHtmlUrl":141},"scripts\u002Fpdf_split.py",3045,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_split.py",{"path":143,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":144,"sourceHtmlUrl":145},"scripts\u002Fpdf_stamp.py",5779,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_stamp.py",{"path":147,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":148,"sourceHtmlUrl":149},"scripts\u002Fpdf_watermark.py",1852,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Fscripts\u002Fpdf_watermark.py",{"path":151,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":152,"sourceHtmlUrl":153},"tests\u002Ftest_pdf_skill.py",17433,"https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fproductivity\u002Fpdf\u002Ftests\u002Ftest_pdf_skill.py",[155,162,169,176,183,190],{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":161,"publishedAt":20},"01M7EWM7FZR5FZ7P9VSG8GGYMT","blocked-page-recovery","Use when a fetch fails: 403\u002F429, paywall, WAF, bot wall.","https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Fweb\u002Fblocked-page-recovery\u002FSKILL.md",[],[],{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":168,"publishedAt":20},"01M7EWM51ZECRG306KP83GHC7E","unreal-world-builder","开放世界与环境专家——精通 UE5 World Partition、Landscape、程序化植被、HLOD 和大规模关卡流式加载，打造无缝开放世界体验","https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Funreal-engine\u002Funreal-world-builder\u002FSKILL.md",[],[],{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":173,"categories":174,"keywords":175,"publishedAt":20},"01M7EWM1Q4FEM4YE0WTSKM82FN","unreal-technical-artist","Unreal Engine 视觉管线专家——精通材质编辑器、Niagara 特效、程序化内容生成和 UE5 项目的美术到引擎管线","https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Funreal-engine\u002Funreal-technical-artist\u002FSKILL.md",[],[],{"skillNo":177,"name":178,"nameZh":6,"description":179,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":180,"categories":181,"keywords":182,"publishedAt":20},"01M7EWKYFYGCVEM3AK40Y3DDJ0","unreal-systems-engineer","性能与混合架构专家——精通 C++\u002FBlueprint 边界、Nanite 几何体、Lumen GI 和 Gameplay Ability System，面向 AAA 级 Unreal Engine 项目","https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Funreal-engine\u002Funreal-systems-engineer\u002FSKILL.md",[],[],{"skillNo":184,"name":185,"nameZh":6,"description":186,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":187,"categories":188,"keywords":189,"publishedAt":20},"01M7EWKVHK186AYQY4M0TZ4WEE","unreal-multiplayer-architect","Unreal Engine 网络专家——精通 Actor 复制、GameMode\u002FGameState 架构、服务端权威玩法、网络预测和 UE5 专用服务器配置","https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Funreal-engine\u002Funreal-multiplayer-architect\u002FSKILL.md",[],[],{"skillNo":191,"name":192,"nameZh":6,"description":193,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":194,"categories":195,"keywords":196,"publishedAt":20},"01M7EWKRPV8H9Z472QYQK373P9","unity-shader-graph-artist","视觉效果与材质专家——精通 Unity Shader Graph、HLSL、URP\u002FHDRP 渲染管线和自定义渲染 Pass，打造实时视觉效果","https:\u002F\u002Fgithub.com\u002Fvallenmulia99\u002Fvallenatrix\u002Fblob\u002Fmain\u002F.vallenatrix\u002Fskills\u002Funity\u002Funity-shader-graph-artist\u002FSKILL.md",[],[]]