Zum Inhalt springen
Skillpedia
PDF, Word & Folien7.8k · #12938

pdf-to-report-workflow

Was er macht

Dieser Skill ist ein durchgängiger Weg, Quell-PDFs zu lesen und mit Kommandozeilenwerkzeugen einen neuen PDF-Bericht zu erstellen. Er richtet sich an Menschen in minimalen oder containerisierten Umgebungen, in denen Python-PDF-Bibliotheken nicht verfügbar sind.

Wann du ihn nutzt

  • ✓Wenn ich Inhalte aus bestehenden PDFs holen und daraus einen neuen PDF-Bericht bauen möchte.
  • ✓Wenn ich mehrere PDF-Quellen zu einem Bericht zusammenführen muss.
  • ✓Wenn PyPDF2 oder reportlab nicht installiert sind und ich sie nicht hinzufügen kann.

Link zum Skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-verification-cli-enhanced-657992/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-verification-cli-enhanced-657992/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Fass den Inhalt dieser drei PDFs in einem neuen Bericht-PDF zusammen. Hier stehen nur Kommandozeilenwerkzeuge zur Verfügung.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Die KI prüft die verfügbaren Werkzeuge, liest Metadaten mit pdfinfo, extrahiert Text mit pdftotext, stellt die Inhalte zusammen und erzeugt dann das endgültige PDF mit einem Werkzeug wie pandoc oder ps2pdf.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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 PDF
  • Title: Document title
  • Author: Document author
  • CreationDate: When the PDF was created
  • ModDate: 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
Häufige Fragen

Welches Werkzeug liest die Seitenzahlen?

pdfinfo, das die Seitenzahl und weitere Metadaten angibt.

Welches Werkzeug holt den Text?

pdftotext, das den gesamten Text oder einen Seitenbereich extrahieren kann.

Welche Werkzeuge erstellen das endgültige PDF?

Die Anleitung nennt Optionen wie pandoc, wkhtmltopdf und enscript mit ps2pdf, je nachdem, was installiert ist.

Details

Originalbeschreibung des Autors

Complete PDF workflow: extract content from source PDFs and generate new PDF reports using command-line tools

repo: HKUDS/AgentPilot

Beliebtheit

GitHub-Sterne
7.8k
Platz im Ranking
#12938
Lizenz
MIT
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills