pdf2table
pdf2table is a Python library designed to extract tabular data from PDF files and images efficiently and accurately. It leverages an enhanced algorithm of img2table library for table detection and the TATR model from Microsoft's Table Transformer for precise table structure recognition and content extraction.
Features
- High Precision of Detection: Compared to Table Transformer's DETR model, rule-based algorithm is less likely to identify text blocks as table regions.
- Maintenance Structural Information: Utilizes state-of-the-art models for table structure recognition to maintain structural information of tables.
- Flexible Input: Supports both PDF files and image formats for table extraction. (More file format will be available later)
- Easy to Use: Simple API allows for straightforward integration into Python projects.
Installation
Install pdf2table using pip:
pip install pdf2table
Usage
Here's a quick example on how to use PDF2Table to extract tables from a PDF file:
from pdf2table import Driver
# Initialize the driver
driver = Driver()
# Extract tables from a PDF
# which returns a list of dataframes
tables = driver.extract_tables("sample.pdf")
Driver object encapsulates the detection and extraction for both PDF object and Image object. If detection is what you need, please refer to the following example:
from pdf2table.document import Image, PDF
# Initialize an Image object
img = Image("sample.jpg")
# Extract all tables from the image
# which returns a list of Table objects
img_tables = img.extract_tables()
# Initialize an PDF object
pdf = PDF("sample.jpg")
pdf_tables = pdf.extract_tables()
You may refer to tutorial for more details
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
Thanks to the creators of the img2table library and Microsoft's Table Transformer model for providing the robust foundations for this tool.
Metadata
Release files for pdf2table 0.1.4
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 |
|---|---|---|---|---|
| pdf2table-0.1.4.tar.gz | 49.9 kB | Without provenance | Details for pdf2table-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdf2table-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for pdf2table-0.1.4-py3-none-any.whl |
Total release size: 114.5 kB
Release files / pdf2table-0.1.4.tar.gz
| Download URL | pdf2table-0.1.4.tar.gz |
|---|---|
| Size | 49.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26a094fc41f502cfd3722ac2f4e79140c526e176a989c45c095e4f954e8c7d61
|
|
BLAKE2b-256 checksum How to use checksums |
97257c8f16530115c98e117d39ccc9b2bd4563e1ba40963fc0598372ab11f8d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Release files / pdf2table-0.1.4-py3-none-any.whl
| Download URL | pdf2table-0.1.4-py3-none-any.whl |
|---|---|
| Size | 64.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f8d0e0934435bdfcd9d629f7353e5b170dd079cc1a58d0f097cda174fda7c3e
|
|
BLAKE2b-256 checksum How to use checksums |
9dbf3f3d5eb1e8101841735ae680dc329955a674a06f927bb890f856d53a49c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.7
|
Security for pdf2table 0.1.4
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.