pdf-to-report-workflow
What it does
This skill is an end-to-end way to read source PDFs and create a new PDF report with command line tools. It is for people in minimal or containerized setups where Python PDF libraries are unavailable.
When to use it
- ✓When I need to pull content out of existing PDFs and make a new PDF report.
- ✓When I need to combine several PDF sources into one report.
- ✓When PyPDF2 or reportlab is not installed and I cannot add them.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-verification-cli-enhanced-657992/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Combine the content of these three PDFs into one new report PDF. Only command line tools are available here.”
5 new skills a week. 1 minute to read.
How it works
The AI checks the available tools, reads metadata with pdfinfo, extracts text with pdftotext, assembles the content and then generates the final PDF with a tool such as pandoc or ps2pdf.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
PDF-to-Report Generation Workflow
This skill provides a complete end-to-end workflow for processing PDF documents: extracting content from source PDFs, assembling report data, and generating new PDF output files—all using command-line tools when Python libraries are unavailable.
When to Use This Skill
- Need to extract text/content from existing PDFs
- Need to create new PDF reports from extracted data
- Need to combine multiple PDF sources into a single report
- PyPDF2, reportlab, or similar Python PDF libraries are unavailable
- Working in minimal/containerized environments
Core Tools
Extraction Tools (poppler-utils)
1. pdfinfo - Extract PDF Metadata
# Get full PDF info
pdfinfo document.pdf
# Get only page count
pdfinfo document.pdf | grep Pages
# Extract page count as a number
pdfinfo document.pdf | grep Pages | awk '{print $2}'
Key metadata fields:
Pages: Number of pages in the PDFTitle: Document titleAuthor: Document authorCreationDate: When the PDF was createdModDate: Last modification date
2. pdftotext - Extract Text Content
# Extract all text to stdout
pdftotext document.pdf -
# Extract text to a file
pdftotext document.pdf output.txt
# Extract text from specific page range
pdftotext -f 1 -l 3 document.pdf output.txt
# Preserve layout (rough formatting)
pdftotext -layout document.pdf output.txt
Generation Tools (Choose based on availability)
1. enscript + ps2pdf - Text to PDF (Recommended)
Convert plain text to PDF via PostScript:
# Install if needed
apt-get install -y enscript ghostscript
# Convert text file to PDF
enscript -B -o output.ps input.txt && ps2pdf output.ps output.pdf
# One-liner
enscript -B input.txt -o - | ps2pdf - output.pdf
Options:
-B: No borders-o: Output file (- for stdout)-f: Font specification (e.g.,-fCourier10)
2. wkhtmltopdf - HTML to PDF
Convert HTML to PDF with full formatting support:
# Install if needed
apt-get install -y wkhtmltopdf
# Convert HTML file to PDF
wkhtmltopdf input.html output.pdf
# Convert from stdin
echo "<html><body><h1>Report</h1></body></html>" | wkhtmltopdf - output.pdf
# With options for better quality
wkhtmltopdf --page-size A4 --margin-top 25mm input.html output.pdf
3. libreoffice - Document Conversion
Convert various document formats to PDF:
# Install if needed
apt-get install -y libreoffice-writer
# Convert to PDF (headless mode)
libreoffice --headless --convert-to pdf input.docx
libreoffice --headless --convert-to pdf input.odt
libreoffice --headless --convert-to pdf input.txt
4. pandoc - Universal Document Converter
Convert between many formats including PDF:
# Install if needed
apt-get install -y pandoc texlive-latex-base
# Convert markdown to PDF
pandoc input.md -o output.pdf
# Convert text to PDF
pandoc input.txt -o output.pdf
# With custom template
pandoc input.md --template=template.tex -o output.pdf
5. pdftk - PDF Manipulation
Merge, split, or modify existing PDFs:
# Install if needed
apt-get install -y pdftk
# Merge multiple PDFs
pdftk file1.pdf file2.pdf file3.pdf cat output merged.pdf
# Extract pages
pdftk input.pdf cat 1-3 output extracted.pdf
# Split into individual pages
pdftk input.pdf burst
Complete Workflow
Phase 1: Check Tool Availability
# Check extraction tools
which pdfinfo || echo "pdfinfo not found"
which pdftotext || echo "pdftotext not found"
# Check generation tools (at least one should be available)
which enscript || echo "enscript not found"
which wkhtmltopdf || echo "wkhtmltopdf not found"
which libreoffice || echo "libreoffice not found"
which pandoc || echo "pandoc not found"
Phase 2: Install Missing Tools
# Debian/Ubuntu - Full installation
apt-get update && apt-get install -y poppler-utils enscript ghostscript
# Or install wkhtmltopdf instead
apt-get install -y poppler-utils wkhtmltopdf
# Or install pandoc for markdown-based reports
apt-get install -y poppler-utils pandoc texlive-latex-base
Phase 3: Extract Content from Source PDFs
# Create working directory
mkdir -p workdir/extracted
cd workdir
# Extract text from each source PDF
for pdf in ../source_pdfs/*.pdf; do
filename=$(basename "$pdf" .pdf)
pdftotext -layout "$pdf" "extracted/${filename}.txt"
echo "Extracted: $filename"
done
# Verify extraction
for txt in ext
FAQ
Which tool reads page counts?
pdfinfo, which reports the number of pages and other metadata.
Which tool gets the text?
pdftotext, which can extract all text or a range of pages.
Which tools make the final PDF?
The guide lists options such as pandoc, wkhtmltopdf and enscript with ps2pdf, depending on what is installed.
Details
Original description by the author
Complete PDF workflow: extract content from source PDFs and generate new PDF reports using command-line tools
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #12938
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.