pdf-extract-create-workflow
Qué hace
Esta skill abarca el ciclo completo de PDF: obtener un PDF, leer su texto y producir un PDF nuevo con formato usando reportlab. Está pensada para quienes trabajan con PDF de sitios web o de sus propios archivos y necesitan un documento nuevo como resultado.
Cuándo usarla
- ✓Cuando el PDF está en un sitio web y primero debe descargarse.
- ✓Cuando necesito el texto de un PDF y después quiero crear un PDF nuevo a partir de ese contenido.
- ✓Cuando el PDF ya está en mi equipo y solo necesito los pasos de extracción y de nuevo documento.
Link de la skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-download-extract-fallback-enhanced-29b2f4/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Descarga este PDF desde el enlace, extrae su texto y después créame un nuevo resumen en PDF estructurado con reportlab.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La IA descarga el archivo con una petición de estilo navegador, comprueba que es un PDF real, extrae el texto con la mejor herramienta disponible y construye un documento nuevo a partir del contenido procesado.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
PDF Extract and Create Workflow
This skill provides a complete PDF lifecycle workflow for acquiring PDF documents from web sources or local files, extracting their text content, AND generating new structured PDFs from processed data—with multiple fallback mechanisms throughout.
Overview
When working with PDFs, you may need to:
- Download PDFs from web sources (with anti-bot protection)
- Extract text content from PDFs (with fallback strategies)
- Generate new PDFs from processed data (with professional formatting)
This workflow ensures maximum success rate through progressive fallback strategies for extraction and templated approaches for generation.
Entry Point: Determine Your Starting Point
Before beginning, identify your scenario:
| Scenario | Start Here | Skip |
|---|---|---|
| PDF already on local disk | Step 2 (Verify File Type) | Step 1 (Download) |
| PDF at a web URL | Step 1 (Download) | None |
| Need to CREATE a PDF from data | Mode C (Generate) | Modes A & B |
| Need to extract AND create | Mode A/B → Mode C | None |
Mode A: Web URL Download
Step 1: Download PDF with Browser User-Agent
Many PDF hosting sites use JavaScript-based redirects or block automated requests. Use curl with a realistic browser user-agent:
curl -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" -o output.pdf "URL_HERE"
Key flags:
-L: Follow redirects-A: Set user-agent header to mimic a real browser-o: Specify output filename
Additional headers for difficult sites:
curl -L \
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
-H "Accept: application/pdf,*/*" \
-H "Accept-Language: en-US,en;q=0.9" \
-H "Connection: keep-alive" \
-o output.pdf "URL_HERE"
Mode B: Local File Processing & Extraction
If you already have the PDF file locally, skip Step 1 and begin here:
Step 2: Verify File Type Before Parsing
Always validate the downloaded file is actually a PDF before attempting extraction:
file output.pdf
Expected output should contain "PDF document". If not:
- The URL may have redirected to an HTML error page
- The file may be corrupted
- Access may be blocked
Step 3: Primary Extraction with pdftotext
First attempt extraction using the standard pdftotext utility (part of poppler-utils):
pdftotext output.pdf output.txt
If pdftotext is not available, install it:
# Debian/Ubuntu
apt-get update && apt-get install -y poppler-utils
# macOS
brew install poppler
# RHEL/CentOS
yum install -y poppler-utils
Step 4: Fallback to PyMuPDF (fitz)
If pdftotext fails or produces poor results, use Python's PyMuPDF library:
import fitz # PyMuPDF
doc = fitz.open("output.pdf")
text = ""
for page in doc:
text += page.get_text()
doc.close()
with open("output.txt", "w") as f:
f.write(text)
Install if needed:
pip install pymupdf
Step 5: Graceful Degradation to Domain Knowledge
If the PDF cannot be accessed or extracted after all attempts:
- Document the failure mode (network issue, corrupted file, access denied, etc.)
- Extract any partial content that was successfully retrieved
- Supplement missing content from established domain knowledge
- Clearly mark which portions are from source vs. generated from knowledge
- Provide citations for any claimed requirements or specifications
Example degradation note:
NOTE: Source document [URL] was inaccessible due to [reason].
Content below combines partial extraction with established domain knowledge
for [topic]. Verify against official sources when available.
Mode C: PDF Generation with ReportLab
After extracting or processing data, generate professional PDFs using Python's reportlab library.
Installation
pip install reportlab
Step C1: Basic Document Structure
Create a multi-page PDF with title page, sections, and proper formatting:
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
from reportlab.lib.enums import TA_CENTER, TA_LEFT
def create_structured_pdf(output_path, title, sections):
"""
Create a structured PDF with title page and sections.
Preguntas frecuentes
¿Qué pasa si la descarga está bloqueada?
La guía usa una petición de estilo navegador y ofrece alternativas cuando la descarga no devuelve un PDF real.
¿Cómo se extrae el texto?
La guía prueba varios métodos en orden, empezando por lecturas sencillas y pasando a herramientas de shell o de Python.
¿Qué biblioteca crea el nuevo PDF?
La guía usa reportlab para producir el nuevo documento estructurado.
Detalles
Descripción original del autor
Complete PDF lifecycle: download, extract, and generate structured documents with reportlab
repo: HKUDS/AgentPilot
Popularidad
- Estrellas en GitHub
- 7,8 mil
- Posición en el ranking
- #12915
- Licencia
- MIT
- Actualizada
- 1/11/2026
Comentarios
- …
Más skills de este repositorio
agentpilot
7,8 milAyuda a tu agente a mejorar un proyecto paso a paso, preparando una tarea y ejecutando el bucle de AgentPilot que propone, prueba y puntúa cambios.
openspace
7,8 milAyuda a tu agente a configurar OpenSpace, una herramienta que guarda y recupera skills de agentes, y a conectarla a tu app de IA mediante MCP.
rsi-arena
7,8 milAyuda a tu agente a configurar y ejecutar pruebas de referencia de IA conocidas, como AIME y Terminal-Bench, para comparar distintos métodos de mejora.
experiment-guide
7,8 milAyuda a tu agente a planificar experimentos pequeños, leer sus resultados y anotar conclusiones mientras investiga cómo mejorar un programa.
Skills parecidas
feishu-doc
394 milAyuda a tu agente a leer, crear y editar documentos en la nube de Feishu, incluidos texto, imágenes y tablas, usando la herramienta de documentos.
feishu-drive
394 milPermite que tu agente explore, organice y comente archivos de una carpeta de la nube de Feishu que se haya compartido con el bot.
feishu-perm
394 milAyuda a tu agente a revisar y cambiar quién puede acceder a un archivo de Feishu, eligiendo el permiso más pequeño que cumpla tu petición.