Saltar al contenido
Skillpedia
PDF, Word y diapositivas7,8 mil · #12920

pdf-engine-fallback

Qué hace

Esta skill es un plan de reintento para la generación de PDF con pandoc que prueba otros motores cuando falla el predeterminado. Está pensada para quienes crean PDF a partir de documentos con texto no inglés o caracteres especiales, o en flujos automatizados.

Cuándo usarla

  • ✓Cuando la generación de PDF con pandoc falla con un error.
  • ✓Cuando el documento contiene texto que no es ASCII, como letras acentuadas o escrituras no latinas.
  • ✓Cuando mi flujo de documentos debe producir PDF en distintos equipos con configuraciones diferentes.

Link de la skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-engine-fallback/SKILL.md

Có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

Usa esta skill para ayudarme: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-engine-fallback/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Pandoc no consigue crear un PDF de mi documento, que tiene texto con tildes y en chino. Revisa los motores y reintenta con uno que maneje esos caracteres.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La IA prueba primero la conversión predeterminada, comprueba qué motores PDF están instalados cuando falla y reintenta con un motor adecuado para el contenido, como xelatex para Unicode o wkhtmltopdf para diseños de estilo web.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

PDF Engine Fallback

This skill provides a diagnostic-retry workflow for PDF generation when Pandoc's default PDF engine fails. It systematically checks available engines and retries with alternatives optimized for different content types (e.g., xelatex for Unicode).

When to Use

  • Pandoc PDF generation fails with errors
  • Document contains non-ASCII characters (Unicode, CJK, etc.)
  • Need robust PDF generation across different system configurations
  • Working in CI/CD or automated document pipelines

Steps

1. Attempt Initial PDF Generation

First, try generating with pandoc's default engine:

pandoc input.md -o output.pdf

2. Diagnose on Failure

If the initial attempt fails, check which PDF engines are available:

# Check for pdflatex
which pdflatex && echo "pdflatex: available" || echo "pdflatex: not found"

# Check for xelatex (better Unicode support)
which xelatex && echo "xelatex: available" || echo "xelatex: not found"

# Check for wkhtmltopdf (HTML-based rendering)
which wkhtmltopdf && echo "wkhtmltopdf: available" || echo "wkhtmltopdf: not found"

3. Retry with Alternative Engine

Based on available engines and document content, retry with an appropriate engine:

# For documents with Unicode/special characters - prefer xelatex
pandoc input.md -o output.pdf --pdf-engine=xelatex

# Alternative: use pdflatex for simple Latin documents
pandoc input.md -o output.pdf --pdf-engine=pdflatex

# For HTML-heavy content or complex layouts
pandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf

4. Handle Missing Engines

If no PDF engines are available, install one:

# Ubuntu/Debian - install texlive with xelatex
sudo apt-get install texlive-xetex

# Or install minimal teTeX
sudo apt-get install texlive-latex-base texlive-latex-extra

# macOS with Homebrew
brew install basictex

Complete Fallback Script

#!/bin/bash
# pdf-fallback.sh - Robust PDF generation with engine fallback

INPUT_FILE="${1:-input.md}"
OUTPUT_FILE="${2:-output.pdf}"

echo "Attempting PDF generation: $INPUT_FILE -> $OUTPUT_FILE"

# Try default engine first
if pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" 2>/dev/null; then
    echo "SUCCESS: PDF generated with default engine"
    exit 0
fi

echo "Default engine failed. Checking available engines..."

# Check and try engines in priority order
if command -v xelatex &>/dev/null; then
    echo "Retrying with xelatex (Unicode support)..."
    if pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" --pdf-engine=xelatex; then
        echo "SUCCESS: PDF generated with xelatex"
        exit 0
    fi
fi

if command -v pdflatex &>/dev/null; then
    echo "Retrying with pdflatex..."
    if pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" --pdf-engine=pdflatex; then
        echo "SUCCESS: PDF generated with pdflatex"
        exit 0
    fi
fi

if command -v wkhtmltopdf &>/dev/null; then
    echo "Retrying with wkhtmltopdf..."
    if pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" --pdf-engine=wkhtmltopdf; then
        echo "SUCCESS: PDF generated with wkhtmltopdf"
        exit 0
    fi
fi

echo "FAILURE: No available PDF engine succeeded"
echo "Install a PDF engine (texlive-xetex recommended) and retry"
exit 1

Usage

# Make executable
chmod +x pdf-fallback.sh

# Run with defaults (input.md -> output.pdf)
./pdf-fallback.sh

# Run with custom files
./pdf-fallback.sh report.md report.pdf

Engine Selection Guide

Engine Best For Unicode Speed
xelatex Non-Latin scripts, modern fonts Excellent Moderate
pdflatex Simple Latin documents Limited Fast
wkhtmltopdf HTML/CSS styling Good Fast

Troubleshooting

  • Font errors: Install required fonts or use xelatex with system fonts
  • Package errors: Install missing LaTeX packages via tlmgr
  • Large documents: Try pdflatex for speed, xelatex for compatibility
  • Citation issues: Ensure pandoc-citeproc or citeproc is installed
Preguntas frecuentes

¿Por qué usar xelatex para Unicode?

La guía indica que xelatex tiene soporte completo de Unicode, lo que encaja con el texto acentuado y de escrituras no latinas.

¿Cómo se comprueban los motores?

La IA ejecuta un comando which para cada motor, para ver si está instalado.

¿Cuándo se usa pdflatex?

La guía sugiere pdflatex para documentos sencillos con texto latino básico.

Detalles

Descripción original del autor

Retry PDF generation with alternative engines when pandoc fails

repo: HKUDS/AgentPilot

Popularidad

Estrellas en GitHub
7,8 mil
Posición en el ranking
#12920
Licencia
MIT
Actualizada
1/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas