Skip to main content

Transforms PDF files into machine readable JSON files

Project description

pdf2data

PyPI version License

Transforms PDF files into machine-readable JSON files. Extracts tables, figures, text blocks, metadata, and references from scientific papers and documents.

Note: The repository is under active development for an article publication. Some errors are expected. Please report any issues on the issues page.

Installation

From PyPI (recommended)

pip install pdf2data-tools

With optional dependencies

# For the full PDF2Data pipeline (layout detection, OCR, etc.)
pip install pdf2data-tools[pdf2data_pipeline]

From source (development)

conda create --name pdf2data python=3.10
conda activate pdf2data
git clone git@github.com:Pocoyo7798/pdf2data.git
cd pdf2data
pip install -e .

Usage

As a library

from pdf2data.pdf2data_pipeline import PDF2Data

pipeline = PDF2Data(
    layout_model="DocLayout-YOLO-DocStructBench",
    input_folder="path/to/pdfs",
    output_folder="path/to/results",
)

Command line

# Extract tables and figures
pdf2data_block path_to_folder path_to_results

# Extract text
pdf2data_text path_to_folder path_to_results

# Extract metadata
pdf2data_metadata path_to_folder path_to_results

# Extract references
pdf2data_references path_to_folder path_to_results

Update and Publish (PyPI)

Use this flow when you make changes and want to publish a new package version.

# 1) Bump version in pyproject.toml
# [project]
# version = "0.0.2"

# 2) (Optional) Keep __version__ in sync
# edit pdf2data/__init__.py

# 3) Install/reinstall build tools
python -m pip install --upgrade build twine

# 4) Clean previous artifacts
rm -rf dist build *.egg-info

# 5) Build package
python -m build

# 6) Validate distribution files
python -m twine check dist/*

# 7) Upload to PyPI
python -m twine upload dist/*

When prompted by twine:

  • Username: __token__
  • Password: your PyPI token (pypi-...)

Verify the release:

pip install --upgrade pdf2data-tools
pip show pdf2data-tools

License

Apache Software License 2.0

Project details


Download files

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

Source Distribution

pdf2data_tools-0.1.0.tar.gz (72.3 kB view details)

Uploaded Source

Built Distribution

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

pdf2data_tools-0.1.0-py3-none-any.whl (79.3 kB view details)

Uploaded Python 3

File details

Details for the file pdf2data_tools-0.1.0.tar.gz.

File metadata

  • Download URL: pdf2data_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 72.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pdf2data_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 79ea971de580ce4ea474982059bf7aee9999cbd376e12cda9b9f719487fb62b9
MD5 273526ba0e3e9e56cb96962c62c5d399
BLAKE2b-256 027596d969b3aa1e7fd9b95ad588818f15f37c65e25fe262b832b1561734dd45

See more details on using hashes here.

File details

Details for the file pdf2data_tools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pdf2data_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 79.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pdf2data_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 992725048673758f8b5bee53b73d6b0f0ddca8260d55b4509d18d8afaa3f199e
MD5 f7862a4144b6541cd48d34ea6ea5438e
BLAKE2b-256 5e9d8f3283dfc66074f581cdd7bc6a516dd6c8fde781866f7a64fcb6b62f6f72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page