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.0.3.tar.gz (68.5 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.0.3-py3-none-any.whl (75.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pdf2data_tools-0.0.3.tar.gz
  • Upload date:
  • Size: 68.5 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.0.3.tar.gz
Algorithm Hash digest
SHA256 0e1cfdd2a62558427bbaade5985f231e5fb5a76ea15cb13ee8a87937ce68de4a
MD5 a1c35d2442da5a8debea1a15e183738a
BLAKE2b-256 fbedea014a871673b4f04b81d1588aba44dc88ff1ad1026775056cd1958eec50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pdf2data_tools-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 75.0 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.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6c2b82d8e4659ebd5ef547df2e2e49494fc0686d9a59455f98e9080944d3aaf1
MD5 2ccacc63ceed8c13a5191083bf151a45
BLAKE2b-256 51142923971c7d82b7c87c282a1cf4950fa6f56c55e075fd69b2b4ad2a0b166b

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