pdf2data
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
Metadata
Release files for pdf2data-tools 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pdf2data_tools-0.1.1.tar.gz | 72.6 kB | Without provenance | Details for pdf2data_tools-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdf2data_tools-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pdf2data_tools-0.1.1-py3-none-any.whl |
Total release size: 152.1 kB
Release files / pdf2data_tools-0.1.1.tar.gz
| Download URL | pdf2data_tools-0.1.1.tar.gz |
|---|---|
| Size | 72.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40da823fbc3ff820c27bcb5039931acc6a23553044624131f78b7dea14fc0222
|
|
BLAKE2b-256 checksum How to use checksums |
165632caaa8f8578e9d67f91d08347e5eecf6c5ebcfaaeadc80a3a11184fde84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / pdf2data_tools-0.1.1-py3-none-any.whl
| Download URL | pdf2data_tools-0.1.1-py3-none-any.whl |
|---|---|
| Size | 79.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
136d0da2ab293500092af8bd50f55b347398b660e5c9628766f635413cca6269
|
|
BLAKE2b-256 checksum How to use checksums |
4eaee0165a4c13bbd88283d6715b8e344ec8b329d8d5e0e06ebb890332b232f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for pdf2data-tools 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.