pandoc-pdf-error-resolution
What it does
This skill gives a structured way to solve pandoc PDF conversion errors when the message is unclear. It is for people who convert documents to PDF and see unknown error messages.
When to use it
- ✓When pandoc returns an unknown error during PDF conversion.
- ✓When the same document converts to HTML or Markdown but not to PDF.
- ✓When I need to find out which PDF engine works on this computer.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pandoc-pdf-error-resolution/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
“Pandoc will not turn my document into a PDF and only says unknown error. Please find which PDF engine works and make it.”
5 new skills a week. 1 minute to read.
How it works
The AI checks the pandoc version, looks for pdflatex, xelatex, lualatex and wkhtmltopdf, retries the conversion with a specific engine, and reads the error to decide what to change.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Pandoc PDF Error Resolution
This skill provides a step-by-step workflow for diagnosing and resolving "unknown error" messages when using pandoc to generate PDFs.
When to Use
Use this skill when:
- Pandoc returns an "unknown error" during PDF conversion
- The conversion succeeds for other formats (e.g., markdown, HTML) but fails for PDF
- You need to identify which PDF engine is available and working
Step-by-Step Procedure
Step 1: Verify Pandoc Installation
First, confirm pandoc is installed and check its version:
pandoc --version
This confirms pandoc is available and shows the version number. Note that pandoc itself doesn't generate PDFs directly—it delegates to external PDF engines.
Step 2: Check Available PDF Engines
Identify which PDF engines are installed on the system:
which pdflatex xelatex lualatex wkhtmltopdf pdfroff 2>/dev/null || echo "Checking individual engines..."
which pdflatex
which xelatex
which lualatex
which wkhtmltopdf
Common engines and their characteristics:
- pdflatex: Fast, widely available, good for basic documents
- xelatex: Better Unicode/font support, recommended for complex documents
- lualatex: Advanced typography, Lua scripting support
- wkhtmltopdf: HTML-to-PDF conversion, good for web-style documents
Step 3: Attempt Conversion with Explicit Engine
Retry the conversion with an explicit --pdf-engine flag:
pandoc input.md -o output.pdf --pdf-engine=xelatex
Try engines in this order:
xelatex(best Unicode support)pdflatex(most widely available)lualatex(if xelatex fails)wkhtmltopdf(for HTML-heavy content)
Step 4: Capture Full stderr Output
Always capture the complete error output before falling back:
pandoc input.md -o output.pdf --pdf-engine=xelatex 2>&1 | tee pandoc_error.log
This preserves the full error message for analysis. Common error patterns:
- Font errors: Missing LaTeX packages or fonts
- Package errors: Missing LaTeX packages (use
tlmgr install <package>) - Syntax errors: Issues in the source document
Step 5: Install Missing Dependencies (if needed)
If errors indicate missing LaTeX packages:
# For TeX Live
tlmgr install <package-name>
# For Debian/Ubuntu
apt-get install texlive-latex-extra texlive-fonts-recommended
# For macOS with Homebrew
brew install --cask mactex
Step 6: Fallback Strategies
If all engines fail, consider:
- Convert to HTML first, then use wkhtmltopdf
- Simplify the document (remove complex formatting)
- Use an online conversion service
- Generate PDF from a different format (e.g., DOCX via LibreOffice)
Example Complete Workflow
#!/bin/bash
# pandoc-pdf-debug.sh
INPUT_FILE="$1"
OUTPUT_FILE="${INPUT_FILE%.md}.pdf"
echo "=== Pandoc PDF Conversion Debug ==="
echo "Input: $INPUT_FILE"
echo "Output: $OUTPUT_FILE"
# Step 1: Verify pandoc
echo -e "\n[1] Checking pandoc version..."
pandoc --version | head -1
# Step 2: Check engines
echo -e "\n[2] Checking available PDF engines..."
for engine in pdflatex xelatex lualatex wkhtmltopdf; do
if which "$engine" &>/dev/null; then
echo " ✓ $engine: $(which $engine)"
else
echo " ✗ $engine: not found"
fi
done
# Step 3: Try conversion with xelatex
echo -e "\n[3] Attempting conversion with xelatex..."
pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" --pdf-engine=xelatex 2>&1 | tee /tmp/pandoc_error.log
if [ $? -eq 0 ]; then
echo "✓ Conversion successful!"
else
echo "✗ Conversion failed. Check /tmp/pandoc_error.log for details"
echo "Attempting fallback with pdflatex..."
pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" --pdf-engine=pdflatex 2>&1
fi
Quick Reference
| Command | Purpose |
|---|---|
pandoc --version |
Verify pandoc installation |
which xelatex |
Check if xelatex engine exists |
pandoc file.md -o file.pdf --pdf-engine=xelatex |
Convert with explicit engine |
... 2>&1 | tee error.log |
Capture full stderr output |
tlmgr install <pkg> |
Install missing LaTeX package |
FAQ
Does pandoc create PDFs on its own?
No, the guide explains that pandoc hands the work to an external PDF engine.
Why check other formats?
If other formats work, the problem is most likely in the PDF engine rather than in the document.
Which engine is better for Unicode?
The guide describes xelatex as having better Unicode and font support than pdflatex.
Details
Original description by the author
Systematic debugging workflow for pandoc PDF conversion errors
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #12905
- 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.