Skip to main content

bolivar

Fast PDF text and table extraction. Written in Rust, drop-in compatible with pdfminer and pdfplumber.

Install

pip install bolivar
implementation("sa.ingenious:bolivar:<version>")
sa.ingenious/bolivar {:mvn/version "<version>"}
[dependencies]
bolivar-core = "<version>"

Extract text

Pull all text from a PDF in one call. The pdfplumber interface opens the file and iterates pages; the pdfminer interface returns the full text directly. JVM and Rust APIs follow the same pattern with their respective conventions.

Path APIs memory-map the source file. Do not change or replace the file until the operation ends and all documents or cursors that use it are released.

import pdfplumber

with pdfplumber.open("doc.pdf") as pdf:
    for page in pdf.pages:
        print(page.extract_text())
from pdfminer.high_level import extract_text

text = extract_text("doc.pdf")
import sa.ingenious.pdf.Document;
import sa.ingenious.pdf.DocumentOptions;

var options = DocumentOptions.builder()
    .maxPages(1)
    .layout(layout -> layout.lineMargin(0.5).wordMargin(0.1))
    .build();

String text = Document.extractText("doc.pdf", options);
import sa.ingenious.pdf.extractText

val text = extractText("doc.pdf") {
    maxPages = 1
    layout {
        lineMargin = 0.5
        wordMargin = 0.1
    }
}
(require '[sa.ingenious.pdf :as pdf])

(def text (pdf/extract-text "doc.pdf"))
use bolivar_core::high_level::extract_text;

fn main() -> bolivar_core::Result<()> {
    let data = std::fs::read("doc.pdf")?;
    let text = extract_text(&data, None)?;
    println!("{text}");
    Ok(())
}

Extract tables

Detect and extract tabular data from each page. JVM table APIs return a closeable, single-pass cursor. Close the cursor to stop work early and release its native state.

Each open cursor has a fixed 50-page window. Those pages include active work and completed results that wait for an earlier page. Several open cursors have separate bounded windows. Close signals cooperative cancellation; active page work stops at its next checkpoint.

import pdfplumber

with pdfplumber.open("doc.pdf") as pdf:
    for page in pdf.pages:
        for table in page.extract_tables():
            print(table)
import sa.ingenious.pdf.Document;
import sa.ingenious.pdf.DocumentOptions;

var options = DocumentOptions.builder().pages(1, 2).build();
try (Document doc = Document.open("doc.pdf", options);
     var tables = doc.tables()) {
    for (var table : tables) {
        System.out.println(table.rowCount() + "x" + table.columnCount());
    }
}
import sa.ingenious.pdf.openDocument

val doc = openDocument("doc.pdf") {
    pages(1, 2)
}
doc.use {
    it.tables().use { tables ->
        for (table in tables) {
            println("${table.rowCount}x${table.columnCount}")
        }
    }
}
(require '[sa.ingenious.pdf :as pdf])

(with-open [doc (pdf/open "doc.pdf" {:pages [1 2]})
            tables (pdf/tables doc)]
  (doseq [table tables]
    (println (:row-count table) "x" (:column-count table))))
use bolivar_core::high_level::{extract_tables_with_document, ExtractOptions};
use bolivar_core::pdfdocument::PDFDocument;
use bolivar_core::table::TableSettings;

fn main() -> bolivar_core::Result<()> {
    let data = std::fs::read("doc.pdf")?;
    let doc = PDFDocument::new(&data, "")?;
    let tables = extract_tables_with_document(
        &doc,
        ExtractOptions::default(),
        &TableSettings::default(),
    )?;
    Ok(())
}

Iterate pages

Walk through pages one at a time to read metadata like page number, dimensions, and a text preview. This is useful when you need to locate content across a large document before extracting specific pages.

import pdfplumber

with pdfplumber.open("doc.pdf") as pdf:
    for page in pdf.pages:
        print(page.page_number, page.width, page.height)
from pdfminer.high_level import extract_pages

for page in extract_pages("doc.pdf"):
    print(page.pageid, page.width, page.height)
import sa.ingenious.pdf.Document;
import sa.ingenious.pdf.DocumentOptions;

var options = DocumentOptions.builder().maxPages(3).build();
try (Document doc = Document.open("doc.pdf", options);
     var pages = doc.pageSummaries()) {
    for (var page : pages) {
        System.out.println(page.pageNumber() + ": " + page.text().substring(0, Math.min(80, page.text().length())));
    }
}
import sa.ingenious.pdf.openDocument

val doc = openDocument("doc.pdf") {
    maxPages = 3
}
doc.use {
    it.pageSummaries().use { pages ->
        for (page in pages) {
            println("${page.pageNumber}: ${page.text.take(80)}")
        }
    }
}
(require '[sa.ingenious.pdf :as pdf])

(with-open [doc (pdf/open "doc.pdf" {:max-pages 3})
            pages (pdf/page-summaries doc)]
  (doseq [page pages]
    (println (:page-number page) (subs (:text page) 0 (min 80 (count (:text page)))))))
use bolivar_core::high_level::extract_pages;

fn main() -> bolivar_core::Result<()> {
    let data = std::fs::read("doc.pdf")?;
    for page in extract_pages(&data, None)? {
        let page = page?;
        println!("{}", page.pageid);
    }
    Ok(())
}

Async (Python)

Run extraction off the main thread in Python while keeping the same pdfplumber API.

import pdfplumber

async with pdfplumber.open("doc.pdf") as pdf:
    for page in pdf.pages:
        for table in page.extract_tables():
            print(table)

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bolivar-2.0.0.tar.gz (5.4 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bolivar-2.0.0-cp314-cp314t-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.14tWindows x86-64

bolivar-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

bolivar-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl (3.4 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ ARM64

bolivar-2.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

bolivar-2.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl (3.3 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

bolivar-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

bolivar-2.0.0-cp314-cp314t-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.14tmacOS 10.12+ x86-64

bolivar-2.0.0-cp311-abi3-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.11+Windows x86-64

bolivar-2.0.0-cp311-abi3-musllinux_1_2_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

bolivar-2.0.0-cp311-abi3-musllinux_1_2_aarch64.whl (3.4 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

bolivar-2.0.0-cp311-abi3-manylinux_2_28_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

bolivar-2.0.0-cp311-abi3-manylinux_2_28_aarch64.whl (3.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

bolivar-2.0.0-cp311-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

bolivar-2.0.0-cp311-abi3-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file bolivar-2.0.0.tar.gz.

File metadata

  • Download URL: bolivar-2.0.0.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bolivar-2.0.0.tar.gz
Algorithm Hash digest
SHA256 3945a0ea37f317a416d5ac9dd7282f03af69f4b1aa584ab742ba74d195cea743
MD5 81c28977d1a00c885d6669aa31f89e79
BLAKE2b-256 01042fd81ca7abb1e60872fb1131e83e6dfe8b1a52ac0939259bfeffd47b5e2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0.tar.gz:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: bolivar-2.0.0-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bolivar-2.0.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 7ad96148094d8ac12486c0f9b095d3dfdf37092fb8f17be8f3a081b50cf38c87
MD5 8648d680adac4b257c9657d56cea787e
BLAKE2b-256 e3b99f70d7a240748d346a5894950dfe6e33e6a999facb370cfa66cbafdcc3c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp314-cp314t-win_amd64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 87dc489eca05768254191f691cc5410995d7da254220f3983a6bfe13bbda20fb
MD5 91d836da3ae7e4f1570d9a15861f4500
BLAKE2b-256 9ad1dc45af5ced78ecada4a645488c231814003962a47931a343642e691a859e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3945c56c0cd65d7ea6e8ef0fb0c085a5a22e8ac3ca0ba5383e6a474ff8bd3259
MD5 ec4ba67c4c76f7dcf30270ba1ca0c8fd
BLAKE2b-256 92fa36f19c2a73e274c53850c333e728589a119d4c3adab42de038405138fc09

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3b61bb40631582bbd68ddcb4d9d0e5d58f70f2adc00f17608e95df6033b42f09
MD5 3c49e5dc8b003d10b7eda1b7da767ebc
BLAKE2b-256 88d6af2ce4e28ae2e961349f9303a17e2ecd81fc9fcfd3d6f245f25963f49809

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e3e023a96df54035788b960f27b792470642ad0e50c26fc3388432baf98de228
MD5 898736c6656f95d0df83f446177c3a81
BLAKE2b-256 d65393294d7e45fa40862767593e50e79e10b74ef53878888470f903f61f8673

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 819a556e15f9880bb37d7bd6c94098249d229ec641bcff58c0b2c6bd84961ed7
MD5 490eaa44a8e72da89d9db2f93a6868c6
BLAKE2b-256 e3a69df35dccb8c40100003ba7f97e35dea682129c1b4885dc089d9ceaea4ef4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp314-cp314t-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp314-cp314t-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 06b2986206f26e67344d1a191cf7ea9428e1e7f9377e701f07ebc1c44c62807a
MD5 d652433f7a68c7f4becd3536c0fd3414
BLAKE2b-256 8ba591b7f230718c959674dc62649bda99171398a0989caed1438c4a24d31114

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp314-cp314t-macosx_10_12_x86_64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: bolivar-2.0.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for bolivar-2.0.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a53632a28ef5127cbf60fc81ec81b0afbb572bb72b2d95a536f0e8aafb4e57df
MD5 48aa91739df8c7191e89043a80ccee7c
BLAKE2b-256 01c65f08c57dd738ac77ae7b6730fc17b3b88fc702ed3a3edf69fc9611aa5321

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp311-abi3-win_amd64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f83fb1a967bafea0719b97ee1dcadabf3496ad643b3e355ce475ef9ade519e8a
MD5 3e7e59adb7150685fa75bf1f8d659fbb
BLAKE2b-256 e45c0287ef23cac8cca5abfe035535111cb592e770e26d6394795d7ca8145c0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp311-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 09bbd2e97265ca2b219a637283bde4d0c287f0075c59aabacd749618389c6f2e
MD5 da25f0e3b13e815227c4e79a0be6b265
BLAKE2b-256 34b6571c6124c80669586e312e4d171aa7ea4f1954dacaaacddb4372ae9b2e76

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp311-abi3-musllinux_1_2_aarch64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 01b578ee694b9110c48f7c7e41fcd07715ddb038915987ad7ac5496549b19329
MD5 b5a06da1d29f37511d374d390edf545a
BLAKE2b-256 7047726b14fdc90c28b1b9bd221b681b74eef600e3d79744b78d366fbd53d3a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp311-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0fa262913df38df16df85d90996fd8d911ba6ea66f0a5f98ebcd2836f379bbb7
MD5 88b4ca2c416bf211f85dd6f90829632f
BLAKE2b-256 596683f4d5afc84d6d0e88a7cf8a78e7bb0ad59e85dd8ab86c2b9c7e5a6914c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp311-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9f2f64b6b382f8585de7ecb54079951c44290397ca8ff788d707543eb2705d2
MD5 3d7edf10789d53dc731dc6b67f484574
BLAKE2b-256 a08d867be94b4cbc142f0f71e6a7eb379ffefd88d18ea3e47c5e8301cb9ffaa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bolivar-2.0.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.0.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bcef5dae8e7dd0809e0ec45f4c32b7d2d7548417ad607d4b4a03a71a3864596e
MD5 628eea7ac28fb4ba144517399a899afe
BLAKE2b-256 656fadf78996692567ee1d38aeb9644ce5f78b2af9ac716f9a9093904ba4eb8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.0.0-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on harubi/bolivar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.2.1

15 files

2.2.0

15 files

2.1.0

15 files

This release

2.0.0 This release

15 files

1.9.3

15 files

1.9.2

15 files

1.9.1

15 files

1.8.0

43 files

1.7.0

45 files

1.6.1

45 files

1.6.0

45 files

1.5.2

45 files

1.5.1

95 files

1.5.0

95 files

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