Read, extract text, fill forms, and overlay text on PDF files using pdftk and pdfjs-dist. Use when working with PDFs — extracting content, filling fillable…
от FDU-INS★ 84 звезды на GitHubОб этом скилле
PDF Skill
Dependencies
pdftk— PDF toolkit for form operations, stamping, merging, splittingpdfjs-dist— Mozilla's PDF.js for text extraction (npm, already installed)google-chrome— Available at/usr/bin/google-chromefor generating overlay PDFs from HTML
Note:
pdfjs-disttext extraction returns empty for scanned/image-based PDFs. For those, burst into individual pages withpdftkand view in the browser to read content visually.
Quick Reference
Extract text from a PDF
node /home/jenn/clawd/skills/pdf/scripts/pdf-extract.js <file.pdf>
List fillable form fields
pdftk <file.pdf> dump_data_fields
Fill a fillable PDF form
Create an FDF file with field values, then:
pdftk <form.pdf> fill_form <data.fdf> output <filled.pdf> flatten
To generate a blank FDF template from a form:
pdftk <form.pdf> generate_fdf output <template.fdf>
Edit the FDF template, setting /V values for each field. For text fields use /V (value). For buttons/checkboxes use /V /OptionName. For Choice/dropdown fields use /V (OptionText) matching one of the FieldStateOption values.
Important: Always use
generate_fdffirst to get the template, then edit the copy. Hand-crafted FDF files may fail to parse — pdftk is picky about the format (needs the binary header bytes from the template).
Overlay text on non-fillable PDFs
For PDFs without form fields, generate an HTML overlay and stamp it:
- Create an HTML file with absolutely positioned text matching PDF coordinates
- Convert to PDF using Chrome:
google-chrome --headless --disable-gpu --print-to-pdf=overlay.pdf --no-margins overlay.html - Stamp onto original:
pdftk original.pdf multistamp overlay.pdf output filled.pdf
Use scripts/pdf-overlay.js to generate the overlay HTML:
node /home/jenn/clawd/skills/pdf/scripts/pdf-overlay.js <config.json> <output.html>
The config.json format (totalPages must match the source PDF page count for multistamp to work correctly):
{
"pageWidth": 612,
"pageHeight": 792,
"totalPages": 7,
"pages": [
{
"page": 1,
"fields": [
{"x": 200, "y": 150, "text": "Boardwise", "fontSize": 10},
{"x": 200, "y": 175, "text": "123 Main St", "fontSize": 10}
]
}
]
}
Coordinates are in PDF points (72 points = 1 inch). Origin is top-left.
To find the right coordinates, screenshot the PDF page and estimate positions based on the layout, or use scripts/pdf-coords.js to get text positions from the existing PDF as reference points.
Reading scanned/image PDFs
When pdf-extract.js returns empty pages, the PDF contains scanned images, not text. To read:
- Burst into individual pages:
pdftk input.pdf burst output page_%02d.pdf - Open each page in the browser (openclaw profile) and screenshot to read visually
- Zoom out with
document.body.style.zoom = '0.35'to see full page in Chrome PDF viewer
Fillable form workflow (end-to-end)
# 1. Check if form has fields
pdftk form.pdf dump_data_fields
# 2. Generate FDF template
pdftk form.pdf generate_fdf output template.fdf
# 3. Copy and edit the template with values
cp template.fdf filled.fdf
# Edit filled.fdf — replace /V () with /V (Your Value) for text fields
# Replace /V /Off with /V /OptionName for buttons/checkboxes
# 4. Fill the form
pdftk form.pdf fill_form filled.fdf output filled.pdf
# 5. Optionally flatten (makes fields non-editable)
pdftk form.pdf fill_form filled.fdf output filled.pdf flatten
Other pdftk operations
# Merge PDFs
pdftk a.pdf b.pdf cat output merged.pdf
# Split pages
pdftk input.pdf cat 1-3 output pages1-3.pdf
# Rotate pages
pdftk input.pdf cat 1-endeast output rotated.pdf
# Get PDF info
pdftk input.pdf dump_data
# Add password
pdftk input.pdf output protected.pdf owner_pw secret
# Remove password
pdftk protected.pdf input_pw secret output unlocked.pdf
# Stamp (overlay on every page)
pdftk input.pdf stamp overlay.pdf output stamped.pdf
# Multistamp (page-matched overlay)
pdftk input.pdf multistamp overlay.pdf output stamped.pdf
# Burst into individual pages
pdftk input.pdf burst output page_%02d.pdf
Установить pdf в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pdf?
Read, extract text, fill forms, and overlay text on PDF files using pdftk and pdfjs-dist. Use when working with PDFs — extracting content, filling fillable form fields, or adding text to non-fillable PDFs via coordinate-based overlays. Handles insurance forms, applications, contracts, and any PDF document processing.
Как установить скилл pdf?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pdf запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic