# Pdf To Markdown

> Converts a PDF file to a Markdown file. Uses pdftotext (poppler) to extract text with layout preservation, then applies heuristics to identify headings and format the output as clean Markdown with YAML front matter. Use when the user wants to convert a PDF document to Markdown for editing, archiving, or ingestion into a knowledge base.

- **Type:** Skill
- **Install:** `agentstack add skill-yohei1126-agent-skills-pdf-to-markdown`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [yohei1126](https://agentstack.voostack.com/s/yohei1126)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [yohei1126](https://github.com/yohei1126)
- **Source:** https://github.com/yohei1126/agent-skills/tree/main/pdf-to-markdown

## Install

```sh
agentstack add skill-yohei1126-agent-skills-pdf-to-markdown
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

## Prerequisites

Install poppler if not already present:

```bash
brew install poppler   # macOS
# or: apt-get install poppler-utils  # Debian/Ubuntu
```

## Instructions

Run the conversion script from the `agent-skills/` directory.

### Usage

```bash
cd agent-skills
npx tsx pdf-to-markdown/scripts/convert.ts  [output.md]
```

| Argument | Required | Description |
|---|---|---|
| `input.pdf` | Yes | Path to the source PDF file |
| `output.md` | No | Output file path. Derived from the input filename if omitted (same directory, `.md` extension). |

### Steps

1. **Run the script** with the PDF path and optional output path.
2. `pdftotext` extracts text with `-layout` (preserves column spacing) and `-nopgbrk` (removes form-feed characters).
3. Heuristics detect headings: short, ALL-CAPS lines surrounded by blank lines become `##` headings.
4. A YAML front matter block is prepended:
   ```
   ---
   source: 
   converted: 
   ---
   ```
5. The file is saved. If the output path already exists, a numeric suffix is appended (e.g. `report-2.md`).

### Examples

```bash
# Derive output from input → saves to: documaris/_inputs/report.md
npx tsx pdf-to-markdown/scripts/convert.ts documaris/_inputs/report.pdf

# Save to a specific path
npx tsx pdf-to-markdown/scripts/convert.ts documaris/_inputs/report.pdf docs/report.md
```

### Edge cases

- If `pdftotext` is not installed, the script exits with an error message.
- If the input PDF does not exist, the script exits with an error.
- Scanned/image-only PDFs will produce empty or near-empty output (no OCR is performed).
- If the derived output path already exists, a numeric suffix is appended rather than overwriting.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [yohei1126](https://github.com/yohei1126)
- **Source:** [yohei1126/agent-skills](https://github.com/yohei1126/agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-yohei1126-agent-skills-pdf-to-markdown
- Seller: https://agentstack.voostack.com/s/yohei1126
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
