PDF documents
Use this Skill for PDF extraction, generation, page operations, forms, metadata, attachments, encryption, and visual review.
Start here
Call skill_view for this Skill first and use the returned baseDirectory for all bundled helpers under /scripts.
Default to a new output file. Do not overwrite or remove source PDFs unless the user explicitly asks. Inspect an input before transforming it, and preserve page order, orientation, dimensions, annotations, and form intent unless the request says otherwise.
Common dependencies:
python3 -m pip install pypdf reportlab pdfplumber
Page rendering uses pypdfium2 when available and can fall back to Poppler's pdftoppm. Check dependencies first; do not install them silently.
Helpers
- pdf_read.py: extract text and document information.
- pdf_page_image.py: render selected pages to images.
- pdf_create.py: create a PDF from structured input.
- pdf_merge.py and pdf_split.py: page composition.
- pdf_fill_form.py, pdf_form_layout.py, and pdf_make_form.py: AcroForm inspection, filling, and creation.
- pdf_watermark.py and pdf_stamp.py: page overlays.
- pdf_meta.py: metadata and attachment operations.
- pdf_secure.py: encrypt or decrypt using password files.
Run helpers with terminal_exec, using python3 as the command and an argument array. Use --help to inspect exact arguments.
python3 <baseDirectory>/scripts/pdf_read.py input.pdf --json
python3 <baseDirectory>/scripts/pdf_page_image.py input.pdf -o rendered --pages 1-3
python3 <baseDirectory>/scripts/pdf_merge.py first.pdf second.pdf -o merged.pdf
python3 <baseDirectory>/scripts/pdf_split.py input.pdf -o pages
For form work, read references/forms.md through skill_view before editing.
Workflow
- Inspect text, metadata, page count, page sizes, encryption state, and form fields as relevant.
- Perform the smallest requested transformation into a new output.
- Re-read the output to verify page count, text, metadata, attachments, or field values.
- Render every changed page, or a representative sample for a large generated document, and inspect it with view_image. Check crop boxes, rotation, clipping, font rendering, overlays, and form appearance.
- Return the absolute output path and list any validation limitations.
Use OCR only when normal text extraction is empty or clearly incomplete. Route scanned documents through the ocr-and-documents Skill.
Passwords and sensitive PDFs
- Do not put PDF passwords in chat, logs, or command arguments.
- Store a supplied password in a temporary file with restrictive permissions and pass --password-file, --user-password-file, or --owner-password-file. Remove that temporary file after the operation.
- PDF permission flags are advisory; do not describe them as strong access control.
- Do not send sensitive PDF contents to external services without the user's authorization.
1---2name: pdf3description: Read, create, merge, split, fill, watermark, stamp, secure, inspect, render, and visually verify PDF files, including AcroForm workflows.4---56# PDF documents78Use this Skill for PDF extraction, generation, page operations, forms, metadata, attachments, encryption, and visual review.910## Start here1112Call skill_view for this Skill first and use the returned baseDirectory for all bundled helpers under <baseDirectory>/scripts.1314Default to a new output file. Do not overwrite or remove source PDFs unless the user explicitly asks. Inspect an input before transforming it, and preserve page order, orientation, dimensions, annotations, and form intent unless the request says otherwise.1516Common dependencies:1718 python3 -m pip install pypdf reportlab pdfplumber1920Page rendering uses pypdfium2 when available and can fall back to Poppler's pdftoppm. Check dependencies first; do not install them silently.2122## Helpers2324- pdf_read.py: extract text and document information.25- pdf_page_image.py: render selected pages to images.26- pdf_create.py: create a PDF from structured input.27- pdf_merge.py and pdf_split.py: page composition.28- pdf_fill_form.py, pdf_form_layout.py, and pdf_make_form.py: AcroForm inspection, filling, and creation.29- pdf_watermark.py and pdf_stamp.py: page overlays.30- pdf_meta.py: metadata and attachment operations.31- pdf_secure.py: encrypt or decrypt using password files.3233Run helpers with terminal_exec, using python3 as the command and an argument array. Use --help to inspect exact arguments.3435 python3 <baseDirectory>/scripts/pdf_read.py input.pdf --json36 python3 <baseDirectory>/scripts/pdf_page_image.py input.pdf -o rendered --pages 1-337 python3 <baseDirectory>/scripts/pdf_merge.py first.pdf second.pdf -o merged.pdf38 python3 <baseDirectory>/scripts/pdf_split.py input.pdf -o pages3940For form work, read references/forms.md through skill_view before editing.4142## Workflow43441. Inspect text, metadata, page count, page sizes, encryption state, and form fields as relevant.452. Perform the smallest requested transformation into a new output.463. Re-read the output to verify page count, text, metadata, attachments, or field values.474. Render every changed page, or a representative sample for a large generated document, and inspect it with view_image. Check crop boxes, rotation, clipping, font rendering, overlays, and form appearance.485. Return the absolute output path and list any validation limitations.4950Use OCR only when normal text extraction is empty or clearly incomplete. Route scanned documents through the ocr-and-documents Skill.5152## Passwords and sensitive PDFs5354- Do not put PDF passwords in chat, logs, or command arguments.55- Store a supplied password in a temporary file with restrictive permissions and pass --password-file, --user-password-file, or --owner-password-file. Remove that temporary file after the operation.56- PDF permission flags are advisory; do not describe them as strong access control.57- Do not send sensitive PDF contents to external services without the user's authorization.