Skip to main content

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.2.0). Text, headings, lists, simple tables and images work well on the test corpus (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 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]
  • Images are written as files and referenced as ![caption](path): on stdout they go to <tmp>/pdfsift/<name>-<hash>/ with absolute paths (the header comment names the directory), with -o out.md to out_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; -q silences them.
  • Exit codes: 0 success (maybe with warnings), 1 error, 2 invalid usage.
  • Output is deterministic: the same PDF always gives the same Markdown.

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 pdftotext interleaves the two columns line by line; -layout puts them side by side on the same line. pdfsift reads column 1, then column 2.
  • pdftotext keeps Chrome's header and footer (date, title, file:///…, 1/3) on every page; pdfsift removes them.
  • pdftotext has 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: pdftotext flattens them into lines; -layout keeps 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.

Methodology and per-document results (in Portuguese): text, tables.

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 -o path.
  • 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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pdfsift 0.2.0
File Actions
pdfsift-0.2.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details for pdfsift-0.2.0-py3-none-win_arm64.whl
pdfsift-0.2.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for pdfsift-0.2.0-py3-none-win_amd64.whl
pdfsift-0.2.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.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pdfsift-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for pdfsift-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pdfsift-0.2.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for pdfsift-0.2.0-py3-none-macosx_11_0_arm64.whl
pdfsift-0.2.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for pdfsift-0.2.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 31.2 MB

Release files / pdfsift-0.2.0-py3-none-win_arm64.whl

Download URL pdfsift-0.2.0-py3-none-win_arm64.whl
Size 4.8 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
e740111ec22b55482660b7c6ed1d70aafd55b5e88e6ab61bfb6305e2deb2a80c
BLAKE2b-256 checksum
How to use checksums
a45f7e1182e85e13e3de6471bb9e00bd63f820cb56f1edb917f0c7b1e3e8cd36
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 log

Release files / pdfsift-0.2.0-py3-none-win_amd64.whl

Download URL pdfsift-0.2.0-py3-none-win_amd64.whl
Size 5.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
71c1a34a649a9afa7165d5ff6b5af923353570e3f99908d11ffb97f22cc4aae5
BLAKE2b-256 checksum
How to use checksums
764a1fae79cd5e0edc7ff00c0f508b9c63486c3e9a0196a308070d60abb9bccf
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 log

Release files / pdfsift-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pdfsift-0.2.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 5.5 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4a872f18d2affe6e5823fd59d728ccda31a3e6b1b0d0395889cd58b77e089c16
BLAKE2b-256 checksum
How to use checksums
21d7740f8480dfab63bd6f6bffbb9df60f8dcc10f04b9a4a794d44c271bead86
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 log

Release files / pdfsift-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pdfsift-0.2.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 5.4 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
58dff560bd2ba89f7d165dde74e2d8920c244c6d08155f52539e9fd01a50477b
BLAKE2b-256 checksum
How to use checksums
c5922751a5484e7cf6c000ecfb419fce2ec7f6fd084c8c011e2242965d8af020
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 log

Release files / pdfsift-0.2.0-py3-none-macosx_11_0_arm64.whl

Download URL pdfsift-0.2.0-py3-none-macosx_11_0_arm64.whl
Size 5.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f5d8a099d897319c606f9ff2da9e554e058dff9c2b706c2a9c168a2d56a52831
BLAKE2b-256 checksum
How to use checksums
203e48c25707558648b65b63b95db2c4c1222dc6da4b5cdcacd04f3f5ce51dab
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 log

Release files / pdfsift-0.2.0-py3-none-macosx_10_12_x86_64.whl

Download URL pdfsift-0.2.0-py3-none-macosx_10_12_x86_64.whl
Size 5.3 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
1a206907209dc340d4c7034fe46e29f6a9f38e04c405b2756180e4002392903e
BLAKE2b-256 checksum
How to use checksums
9ec0e54ff335831a640245ad8e02d2780b417d36ef4ea6dfbf9a0d9f83f30894
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 log

Security for pdfsift 0.2.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.

Select from 6 files

Attestation for pdfsift-0.2.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page