pdfsift
PDF → structured Markdown, built for LLM agents. Headings, paragraphs, lists and tables in reading order, with running headers, footers and line-end hyphens removed. Plain heuristics over what the PDF already contains: no AI model, no OCR, no network.
Status: alpha (0.3.0). Text, headings, lists, simple tables and images work well on the test corpus;
info,toc,--jsonand an MCP server make it easy for agents to read only what they need (see Limitations and the changelog).
$ pdfsift chrome.pdf # two-column test document (in Portuguese)
<!-- pdfsift: source=chrome.pdf pages=1-3/3 -->
<!-- page: 1 -->
# Colunas Estreitas, Hifenização e Ligaduras
Projeto pdfsift
Resumo
Este documento é composto em duas colunas estreitas para forçar a hifenização no fim das linhas, …
# Introdução
A extração de texto de um arquivo PDF parece simples até o primeiro documento em duas colunas. …
Install
Every channel ships the PDFium library (the PDF engine of Chrome) next to the executable; nothing is downloaded at run time.
| Channel | Command |
|---|---|
| npm (no install) | npx @vitorsilverio/pdfsift file.pdf |
| npm (global) | npm install -g @vitorsilverio/pdfsift, then pdfsift file.pdf |
| PyPI (no install) | uvx pdfsift file.pdf or pipx run pdfsift file.pdf |
| PyPI (global) | uv tool install pdfsift or pipx install pdfsift |
| Homebrew | brew install vitorsilverio/tap/pdfsift |
| Shell (Linux, macOS) | curl -LsSf https://github.com/vitorsilverio/pdfsift/releases/latest/download/install.sh | sh |
| PowerShell (Windows) | irm https://github.com/vitorsilverio/pdfsift/releases/latest/download/install.ps1 | iex |
| Archives | .tar.xz/.zip with SHA-256 and build attestations on GitHub Releases |
| Cargo | cargo install pdfsift, then get PDFium (below) |
Prebuilt for Linux (x86_64, aarch64; glibc 2.34+ for the archives, 2.17+ for the PyPI wheels), macOS (x86_64, arm64) and Windows (x86_64, arm64). No musl/Alpine build yet. On npm the package is scoped (@vitorsilverio/pdfsift, because the registry rejects the unscoped name as too close to pdfkit); the installed command is still pdfsift.
PDFium with cargo install: crates.io carries only the source, so download pdfium-<platform>.tgz from bblanchon/pdfium-binaries chromium/8179 and put the library (libpdfium.so, libpdfium.dylib or pdfium.dll) next to the pdfsift executable, or point PDFSIFT_PDFIUM at it. If it is missing, pdfsift says where it looked.
Usage
pdfsift info file.pdf # run first: pages, scanned pages, size in tokens, what to run next
pdfsift toc file.pdf # sections with page ranges, e.g. "- 3 Methods (pp. 4-7)"
pdfsift file.pdf --pages 4-7 # only those pages (PDF page order, from 1)
pdfsift file.pdf # Markdown on stdout
pdfsift file.pdf -o file.md # to a file
pdfsift file.pdf --pages 10-12 # a slice ("3", "2-4", "1,5-7"), to fit a context window
pdfsift file.pdf --no-page-markers
pdfsift file.pdf --assets figs/ # where images go
pdfsift file.pdf --no-images # text only, images as [image: caption]
pdfsift file.pdf --json # the same content as JSON items, each with its page
pdfsift mcp # MCP server on stdio (pdf_info, pdf_toc, pdf_to_markdown)
- Images are written as files and referenced as
: on stdout they go to<tmp>/pdfsift/<name>-<hash>/with absolute paths (the header comment names the directory), with-o out.mdtoout_assets/with relative paths. Open the path to look at an image. <!-- page: N -->marks where each page starts, so an agent can cite pages. A header comment names the source file and the pages converted.- Warnings (for example, a page without a text layer) go to stderr;
-qsilences them. - Exit codes: 0 success (maybe with warnings), 1 missing file / not a PDF / damaged, 2 invalid arguments, 3 encrypted (use
--password), 4 no text in the selection (scans only: the Markdown and page images are still written; run OCR). Errors say what to do next. - Output is deterministic: the same PDF always gives the same Markdown.
For agents
- MCP:
claude mcp add pdfsift -- npx -y @vitorsilverio/pdfsift mcp(Claude Code), or{"command": "npx", "args": ["-y", "@vitorsilverio/pdfsift", "mcp"]}in other clients (more). Tools:pdf_info,pdf_toc,pdf_to_markdown {path, pages?, images?, password?}. - Agent Skill and AGENTS.md snippet:
integrations/. pdfsift --helpis short and written so an agent can use the tool from it alone.
What it does
- Reading order: columns are read one after the other; a paragraph that continues in the next column or page is joined back.
- Hyphenation: words split at line ends are rejoined (
interopera-/bility→interoperability), while real hyphens stay. - Page furniture: running headers, footers and page numbers are dropped.
- Headings: from the PDF outline, the structure tags, or the typography (size and weight), with the right level.
- Lists: bullets, numbers and letters, nested.
- Images: JPEGs are copied unchanged, other images become PNG (with transparency when there is any); each distinct image is written once; ornaments, rules and repeated decorations are dropped; the figure caption becomes the alt text instead of a separate paragraph.
- Figures: a chart or diagram drawn with vector graphics (or made of several images and labels) is rendered as one PNG, so its scattered labels do not end up as stray paragraphs.
- Scanned pages: a page that is only a picture of text is detected and saved as an image (the original JPEG when possible), with a warning to run OCR; a page with an invisible OCR layer keeps its text, marked as coming from OCR.
- Tables: a table whose grid is certain becomes a GFM pipe table, with column alignment; merged cells or an uncertain grid give a fenced code block with the text laid out by position, so nothing is invented. On the test corpus (five producers): every cell right in the simple tables, except one table split across a page break, and no prose mistaken for a table.
Compared with pdftotext
The two-column test document above (15 paragraphs), typeset from the same source by Chrome, LibreOffice, LaTeX and Typst; pdftotext is Xpdf 4.00. "Whole paragraphs" counts source paragraphs that come out as one intact paragraph; "split words" counts line-end hyphens left in the text.
| Producer | pdftotext |
pdftotext -layout |
pdfsift |
|---|---|---|---|
| Chrome | 9/15 whole, 2 split words | 0/15, 2 | 15/15, 0 |
| LibreOffice | 6/15, 3 | 0/15, 56 | 15/15, 0 |
| LaTeX | 0/15, 29 | 0/15, 35 | 13/15, 0 |
| Typst | 0/15, 1 (+ soft hyphens left as spaces) | 0/15, 23 | 15/15, 0 |
Beyond the counts:
- On LaTeX, plain
pdftotextinterleaves the two columns line by line;-layoutputs them side by side on the same line. pdfsift reads column 1, then column 2. pdftotextkeeps Chrome's header and footer (date, title,file:///…,1/3) on every page; pdfsift removes them.pdftotexthas no headings (they are plain lines) and drops Chrome's list markers, gluing items together. pdfsift emits#/##/###at the right level and nested lists.- Size is similar: on a 6-page arXiv paper, 40.2k characters for pdfsift and 40.8k for
pdftotext(53.1k with-layout). Markdown syntax costs about what removing the furniture saves. - Tables:
pdftotextflattens them into lines;-layoutkeeps the alignment but, in two of the test tables (LibreOffice, and a Word-made arXiv paper), shifts values into the wrong row. pdfsift gets both right as GFM tables.
On 14 structure-dependent questions over 18 PDFs (44 question × PDF pairs; evals/), the expected answer appears intact and in order in 95% of pdfsift outputs, against 22% for pdftotext and 43% for pdftotext -layout, at about the same size as plain pdftotext (+4%) and 23% smaller than -layout. The questions were written by the authors on a corpus the heuristics were tuned on, so read this as an upper bound.
Methodology and per-document results (in Portuguese): text, tables, evaluation.
Limitations
- Tables with merged cells come out as a laid-out code block, not a grid; a table split across pages comes out in two parts.
- No OCR: scanned pages are saved as images and reported on stderr. Rotated pages are not handled yet.
- A vector figure without any text label is not rendered; a rendered figure's rectangle can include nearby body text.
- No emphasis, links or footnote handling yet; footnotes appear as paragraphs at the end of the page.
- Encrypted PDFs are not supported.
- The output format may still change before 1.0.
Safety
- No network access, ever. pdfsift reads the input PDF and writes only to stdout or the
-opath. - Parsing is done by PDFium, the engine Chrome uses on untrusted web content; pdfsift's own code is written to skip or reject malformed data rather than crash (fuzzing is planned).
- Release binaries come with SHA-256 checksums and GitHub build attestations (
gh attestation verify <file> --repo vitorsilverio/pdfsift).
Development
scripts/fetch-pdfium.sh # downloads PDFium into .pdfium/ (needs gh)
cargo run -- file.pdf # convert
cargo run -- dump file.pdf # inspect what the PDF engine sees
cargo run -- blocks file.pdf # inspect the layout blocks
scripts/gen-corpus.sh # regenerate test PDFs (pandoc, lualatex, typst, LibreOffice, Chrome)
PDFium is loaded at run time from PDFSIFT_PDFIUM, next to the executable (or in pdfium/ beside it), from .pdfium/<platform>/ (debug builds only), or from the system library path (not on Windows). The design docs are in docs/ (Portuguese): vision, usage, architecture, distribution, roadmap, decisions.
License
Licensed under either of Apache License 2.0 or MIT license, at your option. The binaries also contain PDFium and its dependencies under their own permissive licenses; see THIRD_PARTY_LICENSES.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Metadata
Release files for pdfsift 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pdfsift-0.3.0-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details for pdfsift-0.3.0-py3-none-win_arm64.whl |
| pdfsift-0.3.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for pdfsift-0.3.0-py3-none-win_amd64.whl |
| pdfsift-0.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details for pdfsift-0.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| pdfsift-0.3.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details for pdfsift-0.3.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| pdfsift-0.3.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for pdfsift-0.3.0-py3-none-macosx_11_0_arm64.whl |
| pdfsift-0.3.0-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details for pdfsift-0.3.0-py3-none-macosx_10_12_x86_64.whl |
Total release size: 32.0 MB
Release files / pdfsift-0.3.0-py3-none-win_arm64.whl
| Download URL | pdfsift-0.3.0-py3-none-win_arm64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
1f0d45f8a1dd6f6ec59572c98ceaef64240880accdd930dbce965f713074c988
|
|
BLAKE2b-256 checksum How to use checksums |
c58405a1ec6db3f6f9a04d375c2a65cb50ab3c15b834f88b3bff22b452fce03b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pdfsift-0.3.0-py3-none-win_amd64.whl
| Download URL | pdfsift-0.3.0-py3-none-win_amd64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
49ffc388c27684dbde31c0d15d13957b9ebd2bd756cb29eeee0ff172e2902c7d
|
|
BLAKE2b-256 checksum How to use checksums |
71bc40e9d26e98583769281112222894e79e6b0c0db031d49e23931fd5bca86d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pdfsift-0.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | pdfsift-0.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
ff8083a38b4a51c41fb6cfdc0d867cffddbf1488523acbca21a21b9aeb3f6b4a
|
|
BLAKE2b-256 checksum How to use checksums |
45048d3b2357495679837a49b7f88b9efc7a7facf99efda7414e0313da668f05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pdfsift-0.3.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | pdfsift-0.3.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 5.5 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
9834748e6e192a2e55f63732c7582a062fd77d14e5bee1379f204168b83d3bfc
|
|
BLAKE2b-256 checksum How to use checksums |
18fa20d4435ddf17a3e5feb361fb6f66317b45cd8eb1f49a95180455e02689a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pdfsift-0.3.0-py3-none-macosx_11_0_arm64.whl
| Download URL | pdfsift-0.3.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.2 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d51125ff81c1fefd61ca5eb0ab60afefeb2c6902e81533451a29167798c62386
|
|
BLAKE2b-256 checksum How to use checksums |
c20985d049fb5bb29fc11eb69dae73b9578d7da4fa2b579d7f0e1902ec72485d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pdfsift-0.3.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | pdfsift-0.3.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
6e3f869820f7f2b2daa241b8874ce927ca36eb0a11472f3ea871e48cc8a4dabc
|
|
BLAKE2b-256 checksum How to use checksums |
7bf4bec29c09e23cc4e8d22d2a25865be78d8049780970b494fde595f7ab6702
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for pdfsift 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for pdfsift-0.3.0-py3-none-win_arm64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.