본문으로 건너뛰기
Skillpedia
PDF, Word, 슬라이드7.8k · #12938

pdf-to-report-workflow

하는 일

이 스킬은 명령줄 도구로 원본 PDF를 읽고 새 PDF 보고서를 만드는 처음부터 끝까지의 방법입니다. Python PDF 라이브러리를 쓸 수 없는 최소 환경이나 컨테이너에서 작업하는 사람에게 맞습니다.

사용하는 경우

  • ✓기존 PDF의 내용을 꺼내 새 PDF 보고서를 만들어야 할 때.
  • ✓여러 PDF 출처를 하나의 보고서로 합쳐야 할 때.
  • ✓PyPDF2나 reportlab을 설치할 수 없고 추가할 수도 없는 경우.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-verification-cli-enhanced-657992/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 세 PDF의 내용을 하나의 새 보고서 PDF로 합쳐 주세요. 여기서는 명령줄 도구만 쓸 수 있습니다.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 사용 가능한 도구를 확인하고, pdfinfo로 메타데이터를 읽고, pdftotext로 텍스트를 추출하며, 내용을 모아 pandoc이나 ps2pdf 같은 도구로 최종 PDF를 만듭니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

어떤 도구가 쪽수를 알려 주나요?

pdfinfo입니다. 쪽수와 다른 메타데이터를 보고합니다.

어떤 도구가 텍스트를 얻나요?

pdftotext입니다. 전체 텍스트나 특정 쪽 범위의 텍스트를 추출할 수 있습니다.

최종 PDF는 어떤 도구로 만드나요?

설치된 것에 따라 pandoc, wkhtmltopdf, enscript와 ps2pdf 같은 선택지가 있다고 가이드가 나열합니다.

상세 정보

작성자의 원본 설명

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

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#12938
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬