npx machina-cli add skill valkryhx/google_adk_agent/pdf --openclawPDF Skill
Overview
This skill provides a comprehensive set of tools for working with PDF files. It supports extracting text and tables, converting pages to images, and filling out both fillable and non-fillable PDF forms.
Usage
1. Extract PDF Content
Extracts text and tables from a PDF and outputs a formatted Markdown file.
# Windows (Recommended)
cmd /c set PYTHONIOENCODING=utf-8 && python skills/pdf/scripts/extract_pdf_content.py [input_pdf] [output_md]
# Unix/macOS
python skills/pdf/scripts/extract_pdf_content.py [input_pdf] [output_md]
2. Convert PDF to Images
Converts each page of a PDF into a PNG image. Useful for visual analysis or OCR.
# Windows (Recommended)
cmd /c set PYTHONIOENCODING=utf-8 && python skills/pdf/scripts/convert_pdf_to_images.py [input_pdf] [output_directory]
# Unix/macOS
python skills/pdf/scripts/convert_pdf_to_images.py [input_pdf] [output_directory]
3. Handle PDF Forms
Extract Form Field Info
Identifies fillable fields in a PDF and saves their metadata to JSON.
# Windows (Recommended)
cmd /c set PYTHONIOENCODING=utf-8 && python skills/pdf/scripts/extract_form_field_info.py [input_pdf] [output_json]
# Unix/macOS
python skills/pdf/scripts/extract_form_field_info.py [input_pdf] [output_json]
Fill Fillable Fields
Fills standard PDF form fields using values from a JSON file.
# Windows (Recommended)
cmd /c set PYTHONIOENCODING=utf-8 && python skills/pdf/scripts/fill_fillable_fields.py [input_pdf] [field_values_json] [output_pdf]
# Unix/macOS
python skills/pdf/scripts/fill_fillable_fields.py [input_pdf] [field_values_json] [output_pdf]
Fill with Annotations
Fills non-fillable PDFs by adding text annotations at specific coordinates.
# Windows (Recommended)
cmd /c set PYTHONIOENCODING=utf-8 && python skills/pdf/scripts/fill_pdf_form_with_annotations.py [input_pdf] [fields_json] [output_pdf]
# Unix/macOS
python skills/pdf/scripts/fill_pdf_form_with_annotations.py [input_pdf] [fields_json] [output_pdf]
Examples
User: "Extract the text from 'report.pdf' and save it to 'report.md'." Action:
# Windows (Recommended)
cmd /c set PYTHONIOENCODING=utf-8 && python skills/pdf/scripts/extract_pdf_content.py "report.pdf" "report.md"
# Unix/macOS
python skills/pdf/scripts/extract_pdf_content.py "report.pdf" "report.md"
User: "Convert 'presentation.pdf' to images in the 'slides' folder." Action:
# Windows (Recommended)
cmd /c set PYTHONIOENCODING=utf-8 && python skills/pdf/scripts/convert_pdf_to_images.py "presentation.pdf" "slides"
# Unix/macOS
python skills/pdf/scripts/convert_pdf_to_images.py "presentation.pdf" "slides"
Scripts Reference
| Script | Description |
|---|---|
extract_pdf_content.py | Extracts text/tables to Markdown. |
convert_pdf_to_images.py | Converts PDF pages to PNG. |
extract_form_field_info.py | Gets fillable field metadata. |
fill_fillable_fields.py | Fills standard PDF forms. |
fill_pdf_form_with_annotations.py | Fills forms via annotations. |
check_bounding_boxes.py | Validates field coordinates. |
Source
git clone https://github.com/valkryhx/google_adk_agent/blob/main/skills/pdf/SKILL.mdView on GitHub Overview
This skill provides tools for working with PDF files. It covers extracting text and tables to Markdown, converting pages to images for OCR or previews, and filling both fillable and non-fillable PDF forms, including annotations. It also enables extracting form field metadata for smarter automation.
How This Skill Works
A collection of Python scripts under skills/pdf/scripts handles PDFs. Each script takes an input PDF and produces outputs like Markdown, images, JSON, or updated PDFs. Typical workflows combine scripts to extract content, gather form field data, and fill or annotate forms as needed.
When to Use It
- Automate extraction of reports or invoices into Markdown for documentation
- Create image-based assets from PDFs for OCR or visual previews
- Auto-fill standard form fields in PDFs from a JSON payload
- Annotate non-fillable PDFs with text notes at specific coordinates
- Validate PDF form field positions and metadata with bounding box checks
Quick Start
- Step 1: Choose a script based on your task (e.g., extract_pdf_content.py, convert_pdf_to_images.py, or fill_fillable_fields.py)
- Step 2: Prepare inputs: input_pdf, output paths, and any JSON payloads; on Windows, set PYTHONIOENCODING=utf-8
- Step 3: Run the script with required arguments, for example: python skills/pdf/scripts/extract_pdf_content.py input.pdf output.md
Best Practices
- Use extract_pdf_content.py first to map the document structure before filling forms
- Run extract_form_field_info.py to generate form field metadata JSON
- Prepare field_values_json that exactly matches field names for fill_fillable_fields.py
- For non-fillable PDFs, use fill_pdf_form_with_annotations.py with coordinates and verify results with check_bounding_boxes.py
- On Windows, run with 'cmd /c set PYTHONIOENCODING=utf-8' to avoid encoding issues
Example Use Cases
- Extract text and tables from 'report.pdf' into 'report.md'
- Convert 'presentation.pdf' pages to PNG images in the 'slides' folder
- Fill standard fields in 'invoice.pdf' using 'values.json' to produce 'filled_invoice.pdf'
- Annotate 'contract.pdf' with approval notes using 'annotations.json'
- Run field-coordinate validation on 'form.pdf' with bounding box checks