SuperAPI AI Directory

pdf-to-markdown

Office & productivity

View repository

Updated 10-15 17:22

About this skill

Read a PDF file

Converts a PDF to Markdown and prints to stdout:

uv run --with pymupdf4llm ~/.kiro/skills/pdf-to-markdown/scripts/pdf_to_markdown.py "<path_to_pdf>"

Save as .md file:

uv run --with pymupdf4llm ~/.kiro/skills/pdf-to-markdown/scripts/pdf_to_markdown.py "<path_to_pdf>" "<output.md>"

Write a PDF file

Preferred: Directly from markdown content (no intermediate file)

Pipe markdown content directly using --stdin:

echo '<markdown_content>' | uv run --with pymupdf ~/.kiro/skills/pdf-to-markdown/scripts/markdown_to_pdf.py --stdin "<output.pdf>"

For multi-line content, use a heredoc:

uv run --with pymupdf ~/.kiro/skills/pdf-to-markdown/scripts/markdown_to_pdf.py --stdin "<output.pdf>" <<'EOF'
# Title

Some paragraph with content.

- Bullet point 1
- Bullet point 2

1. Numbered item
2. Another item
EOF

From an existing Markdown file

uv run --with pymupdf ~/.kiro/skills/pdf-to-markdown/scripts/markdown_to_pdf.py "<input.md>" "<output.pdf>"

If you had to create the .md file as an intermediate step, delete it after generating the PDF.

Notes

  • Read uses pymupdf4llm for high-quality text extraction preserving structure, tables, and image references.
  • Write uses pymupdf (fitz) to generate styled A4 PDFs with headings, bullets, numbered lists, blockquotes, and horizontal rules.
  • Dependencies are auto-installed via uv run.
  • IMPORTANT: Do NOT create intermediate markdown files if you can pipe content directly via --stdin. If you must create one, always delete it after.