Generated banner for Convert PDF To Md
Generated logo for Convert PDF To Md

Convert PDF To Md

GitHubOfficialFirst committed by 1YaoWei0Distributed by GitHub

  • Skill
  • Tool integration
  • Automation and integrations
  • MIT
  • Low risk
  • Has scripts

From the author

Converts PDF (.pdf) documents into Markdown so their contents can be accurately analyzed, summarized, searched, or extracted from. Use this skill whenever the user shares, references, or asks about a .pdf file — even if they don't say "convert" or "markdown" explicitly. This includes requests to "read", "summarize", "review", "extract data from", "compare", or "analyze" a PDF report, paper, invoice, form, contract, or scanned document. Always run the bundled conversion script to produce Markdown first; do not attempt to parse PDF content directly or write ad-hoc extraction code. Also use this skill for batch requests involving a whole folder of PDF documents. IMPORTANT: When the user references a folder or set of documents containing multiple file types (.pdf, .docx, .xlsx), invoke ALL three sibling skills — convert-pdf-to-md, convert-word-to-md, and convert-excel-to-md — so no file type is silently skipped.
— the description by 1YaoWei0

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a reliable way to convert PDF files into Markdown, enabling AI agents to accurately analyze, summarize, or extract data from documents. Because PDFs are layout-oriented, this skill uses a dedicated script to parse text and tables via MarkItDown while simultaneously extracting embedded images using PyMuPDF. It handles single files or batch processing of entire folders and ensures that extracted images are organized into a structured output folder, maintaining a clear separation between document text and visual assets.

What it does

  • Converts PDF files into Markdown format for easier processing.
  • Extracts embedded images from PDFs and saves them into a dedicated subfolder.
  • Supports batch processing of entire folders, including recursive subfolder traversal.
  • Appends extracted images to the end of the Markdown file in a structured appendix.
  • Integrates with sibling skills to handle mixed-format document batches.
  • Provides clear error reporting for corrupt, password-protected, or image-only PDFs.

When to use it

  • When a user asks to read, summarize, or analyze a PDF document.
  • When you need to extract specific data or tables from a PDF report, invoice, or contract.
  • When processing a folder containing multiple PDF files.
  • When a user provides a mix of PDF, Word, and Excel files, requiring coordinated conversion.

Advantages

  • Ensures consistent and accurate text extraction from complex PDF layouts.
  • Preserves embedded images by extracting them into a separate, organized directory.
  • Prevents data loss in mixed-format batches by coordinating with sibling conversion skills.
  • Provides a standardized output structure that is easy to navigate and analyze.

Usage examples

“Can you summarize this invoice.pdf for me?”
The agent invokes the conversion script to turn the PDF into Markdown, then reads the resulting text to provide a summary.
“Analyze all the reports in C:\Documents\Q3_Reports”
The agent runs the conversion script in batch mode on the specified folder, then processes the generated Markdown files to perform the analysis.
“Extract the data from these files: project.pdf, notes.docx, and budget.xlsx”
The agent invokes convert-pdf-to-md, convert-word-to-md, and convert-excel-to-md in parallel to ensure all files are processed.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/github/convert-pdf-to-md/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip convert-pdf-to-md.zip -d .agents/skills

Documentation by 1YaoWei0

Convert PDF to Markdown

When to use this skill

Trigger this skill any time there is a .pdf file that needs to be understood or processed — for example, a user attaches a PDF and asks questions about it, wants a summary, wants specific data or tables pulled out, or wants multiple PDFs in a folder processed together. PDF is a layout/print format, not reliably readable as plain text, so always convert it to Markdown first using the script in this skill rather than trying to open or parse the file directly.

This skill only supports .pdf — that's MarkItDown's only PDF-family format, so there's no legacy format to worry about here (unlike Word's .doc or Excel's .xls).

Mixed file types: When the user references a folder or set of documents containing multiple supported file types (.pdf, .docx, .xlsx), this skill handles only .pdf files. The agent MUST also invoke the sibling skills in parallel:

  • convert-word-to-md for any .docx files

  • convert-excel-to-md for any .xlsx files

Never process a folder and silently skip a supported file type. All three skills must be invoked together when mixed types are present.

Setup (once per environment)

Before the first conversion in a given environment, follow references/setup.md step by step to ensure Python, pip, markitdown, and pymupdf (for image extraction) are installed. Do this proactively rather than guessing whether the environment is ready — the script itself will also fail with a clear pointer back to that file if a dependency turns out to be missing, so it's safe to just try the conversion first if you're reasonably confident setup was already done.

Usage

The conversion script lives at scripts/convert_pdf_to_md.py.

Output structure: MarkItDown's PDF converter extracts text and tables only — it has no concept of embedded images at all. This script separately extracts real embedded images via PyMuPDF and writes a self-contained folder per document:

<name>/
    img/
        page001_img001.<ext>
        page002_img001.<ext>
        ...
    <name>.md

Because MarkItDown's PDF text does not preserve reliable per-page markers, there's no safe way to know exactly where inline an image belongs. Rather than risk misplacing images next to the wrong paragraph, the script appends a ## Extracted Images section at the end of the Markdown, with a ### Page N subheading per page that has images — read this section separately from the main body text. If the document has no embedded images, no img/ folder or Extracted Images section is created.

Single file:

python scripts\convert_pdf_to_md.py "C:\path\to\document.pdf"

This creates a document\ folder next to the source file (containing document.md and, if present, document\img\). To control the destination folder explicitly:

python scripts\convert_pdf_to_md.py "C:\path\to\document.pdf" -o "C:\path\to\output_folder"

A folder of PDFs (batch mode):

python scripts\convert_pdf_to_md.py "C:\path\to\folder"

Add --recursive to also include subfolders:

python scripts\convert_pdf_to_md.py "C:\path\to\folder" --recursive

Each .pdf found gets its own <name>\ output folder next to it by default. Pass -o "C:\path\to\output_parent" to collect all the generated <name>\ folders under a separate parent directory instead (subfolder structure is preserved when combined with --recursive).

After conversion, read the resulting .md file(s) to perform the actual analysis the user asked for — the script's job is only to produce accurate Markdown (and images), not to interpret the content.

Deciding where output goes

Default — always output next to the source file. The <name>/ folder is created in the same directory as the source .pdf. This is the required default for every case. Do NOT override it unless the user explicitly asks for a different location.

Only use -o when the user explicitly provides an output path (e.g., "save the output to C:\output", "put the results in D:\work"). Do NOT pass -o based on the agent's current working directory, the session state folder, or any implied location.

If the source file path cannot be fully resolved — for example, the user provides only a filename with no directory, or the path is ambiguous — use ask_user to confirm the full absolute path before running the conversion. Never guess or assume the directory.

Troubleshooting

SymptomLikely causeFix
ModuleNotFoundError: No module named 'markitdown' or 'fitz' / exit code 2MarkItDown or PyMuPDF not installedFollow references/setup.md
ERROR: Unsupported file type '...' / exit code 3Not a .pdf fileAsk the user for the correct file, or if it's .doc/.docx/.xlsx, use the matching sibling skill instead
ERROR: Input path not found / exit code 3Wrong path, or file movedConfirm the correct path with the user
FAILED <file> -> ... in batch outputThat specific file is corrupt, password-protected, or otherwise unreadableReport which file(s) failed; other files in the batch still succeed
NOTE: skipped N non-.pdf file(s)Folder contains non-PDF filesExpected — those files are intentionally ignored
Markdown body is empty or near-empty despite images being extractedThe PDF is scanned/image-only with no embedded text layer; MarkItDown does not perform OCRTell the user OCR isn't supported — the extracted page images are still available for them to view
Images appear in an appendix instead of inline with the textDeliberate limitation — MarkItDown's PDF text has no reliable per-page markers to place images inlineExpected behavior; cross-reference the ### Page N heading with the surrounding text context if needed

Files

Requirements and compatibility

Written for: GitHub Copilot

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Python

Security

What our scanner noticed· Low risk

  • Instructions that use the network
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

First committed by
GitHub avatar of 1YaoWei01YaoWei0
Publisher
GitHub (Official)
Distributed by
GitHub
Source
github/awesome-copilot · skills/convert-pdf-to-md · commit 797337f
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
1YaoWei0

AutoGineer is not affiliated with or endorsed by 1YaoWei0 or GitHub.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download convert-pdf-to-md.zip