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.2.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.2.0-cp314-cp314t-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.14tWindows x86-64

bolivar-2.2.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.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl (3.4 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ ARM64

bolivar-2.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14tmacOS 11.0+ ARM64

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

Uploaded CPython 3.14tmacOS 10.12+ x86-64

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

Uploaded CPython 3.11+Windows x86-64

bolivar-2.2.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.2.0-cp311-abi3-musllinux_1_2_aarch64.whl (3.4 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

bolivar-2.2.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.2.0-cp311-abi3-manylinux_2_28_aarch64.whl (3.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

bolivar-2.2.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.2.0.tar.gz.

File metadata

  • Download URL: bolivar-2.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 7a87a616f238aedef9397663c2155b3be62ce4140d9eacda82a202f7f03c313e
MD5 4bffc35bf37b53d248aaaf128ed1fa18
BLAKE2b-256 e4d0d1a940495f69d7c779e678854df0f795c9ee5f82d8c763184e3c2509f279

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: bolivar-2.2.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.2.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 100ee4d2f3068eac7412f60838aabd3518d6f6c88e0d39af0242e4da34c876a6
MD5 5e6cfb91b27f5af074e27c2a657f4c6a
BLAKE2b-256 58e44f7490dd1bbe8e95bd99b55baca11a88b2ce54051bfc247106c22ab8ae90

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f3fdd14ddf2923699698a770e473fc6b1d7c4d4459b775bc7ba5b9323a93d324
MD5 4296f0e4f59ad59ef6a61f2a1da2d38f
BLAKE2b-256 f0ad4c177e28dc908ff5c7b540a1d17313e238efe198089b00cbb58b08241c98

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 aec31a9aad3465fda0363998d2495e28363d92c0d53b84ee2e246eb8331f7951
MD5 f933fbb1924505f191695e26e4bffbfe
BLAKE2b-256 0b0bff7d90a07f89dc2c7a3beb1f1124ee4e6eebab2ea95eafa15e1a64426b47

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 25147880ae06a6666df484c442c704d93de86e6426efd7c0dbeb3a43d34bf536
MD5 12b5911172a48cec3c2e6e743c4b0973
BLAKE2b-256 fc1ab02366e34d1d662bd245bccbae774f9c711fba7b21be40eec012af6b5be5

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9241f276f9c083000daa4d0e4996a3714b11271d0b73b3c2399b0309f8952cee
MD5 cc8cf67e3773dce0ce249be51acbb5a4
BLAKE2b-256 0843512b042789893494528325bd37a59afab8be9832ea7a5bb43d127ba8c91f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60953786942af48b5f7c2713f23f754affbea99db9ebe408f79780bf418155ee
MD5 9b084beeaa363dc4e4028f1f27e40cc2
BLAKE2b-256 085de7a73129d14e2a4de5ece046e868bdda85b548c992594cad073135dbdb8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp314-cp314t-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp314-cp314t-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3525c331c054f666d93e3ecea2e4090a239791b63c33b1caad944442042da799
MD5 01fa3946057eddae80331881c16d5441
BLAKE2b-256 eaed3b3f58ea935ece597823329e1dcb5f0f2147da1ec4f6ad2958291a674242

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: bolivar-2.2.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.2.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2ca0e178850baeccd2d86e58d177165228227a2189559e7ea88a37ff2db56432
MD5 f96aa73de751b3817457295538f922ec
BLAKE2b-256 feb2eba383e65ac1a731cafc957a08481ff1815302dfe9810393c004531e1473

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a5f843594e8a20acc4501a0dd8ff1425ec880cbadd439e38b8983192d1af09ba
MD5 a20a6e0686cc6c7d0860faf5c6ebb4b5
BLAKE2b-256 209aa612ce92b8094af478af7743c803586ecea36f2b78e15fa1b24ed36aad5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 0730c40e3a7fd08cd6b86ea183710842c0e66a341bd7d094cf76b115b28dd7ce
MD5 70a770e7ed012dba13a2073ae5e1a514
BLAKE2b-256 f03759bbc1304062a7552a064f292fa57fbffa72c3f71fba729a937d56645d51

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8b917d4143ca1e86d6084006f7fa5b2e0fb165b48d1825e7c09f5500bfc6c226
MD5 1f7246fd0b08896f1faef46344db958b
BLAKE2b-256 d006d437442a5d1cd7abe7075126e297a8a9b7804d42e5d5324f186edf2a8127

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 08deb92a102c620efde5509dfba3c4baa7a6f585206906ef9558a981991e705f
MD5 6a53919c6d8db19d315c10e1952a08f4
BLAKE2b-256 5bdc35aebf5e4b9006408c97ad07f1af7defdfbd49b7e57d8ca99f3b781148ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4fd450e98d8310bf4d73bd37c391e9885abe65c4cd50c21abebc4ae3d7c14b39
MD5 00f907dfb231c4dcf86209aa2ffa504f
BLAKE2b-256 21f5296fed0af477931227d92b5847bc65f37417dbf34cee0b2509614588bf2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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.2.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bolivar-2.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 72f818686d2bde39f74b6ec68a676903c2b3e9caa40571a372004724cb3765a2
MD5 c2546d5d390a047f2c8f9b89176e7bf7
BLAKE2b-256 4a7fe305c02e9f234839d7d03ad0e271cdd5db0f69cc90b976fe6225b434f439

See more details on using hashes here.

Provenance

The following attestation bundles were made for bolivar-2.2.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

This release

2.2.0 This release

15 files

2.1.0

15 files

2.0.0

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