A python wrapper for the Doc2X API and comes with native texts processing (to improve texts recall in RAG).
Project description
Handle PDF more easily and simply, utilizing Doc2X's powerful document conversion capabilities for retained format file conversion/RAG enhancement.
Introduction
Doc2X Support
Doc2X is a new universal document OCR tool that can convert images or PDF files into Markdown/LaTeX text with formulas and text formatting. It performs better than similar tools in most scenarios. pdfdeal
provides abstract packaged classes to use Doc2X for requests.
Processing PDFs
Use various OCR or PDF recognition tools to identify images and add them to the original text. You can set the output format to use PDF, which will ensure that the recognized text retains the same page numbers as the original in the new PDF. It also offers various practical file processing tools.
After conversion and pre-processing of PDF using Doc2X, you can achieve better recognition rates when used with knowledge base applications such as graphrag, Dify, and FastGPT.
Cases
graphrag
See how to use it with graphrag, its not supported to recognize pdf, but you can use the CLI tool doc2x
to convert it to a txt document for use.
Fastgpt/Dify or other RAG system
Or for knowledge base applications, you can use pdfdeal
's built-in variety of enhancements to documents, such as uploading images to remote storage services, adding breaks by paragraph, etc. See Integration with RAG applications.
Documentation
For details, please refer to the documentation
Or check out the documentation repository pdfdeal-docs.
Quick Start
For details, please refer to the documentation
Installation
Install using pip:
pip install --upgrade pdfdeal
If you need document processing tools:
pip install --upgrade "pdfdeal[rag]"
Use the Doc2X PDF API to process all PDF files in a specified folder
from pdfdeal import Doc2X
client = Doc2X(apikey="Your API key",debug=True)
success, failed, flag = client.pdf2file(
pdf_file="tests/pdf",
output_path="./Output",
output_format="docx",
)
print(success)
print(failed)
print(flag)
Use the Doc2X PDF API to process the specified PDF file and specify the name of the exported file
from pdfdeal import Doc2X
client = Doc2X(apikey="Your API key",debug=True)
success, failed, flag = client.pdf2file(
pdf_file="tests/pdf/sample.pdf",
output_path="./Output/test/single/pdf2file",
output_names=["sample1.zip"],
output_format="md_dollar",
)
print(success)
print(failed)
print(flag)
See the online documentation for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pdfdeal-0.4.9.tar.gz
.
File metadata
- Download URL: pdfdeal-0.4.9.tar.gz
- Upload date:
- Size: 116.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23bd7a8e8ccd307bf69ffb3054d2a6241aad5052b8483f8b6b5ae6cc41ac8beb |
|
MD5 | 1b057e66fd2089c2babc80468d35a0df |
|
BLAKE2b-256 | 5ba790b7a3aa30d5c74be70bf8b98678d71721cccde0384ee22192ee08ff7b32 |
Provenance
The following attestation bundles were made for pdfdeal-0.4.9.tar.gz
:
Publisher:
python-publish.yml
on Menghuan1918/pdfdeal
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pdfdeal-0.4.9.tar.gz
- Subject digest:
23bd7a8e8ccd307bf69ffb3054d2a6241aad5052b8483f8b6b5ae6cc41ac8beb
- Sigstore transparency entry: 149418543
- Sigstore integration time:
- Predicate type:
File details
Details for the file pdfdeal-0.4.9-py3-none-any.whl
.
File metadata
- Download URL: pdfdeal-0.4.9-py3-none-any.whl
- Upload date:
- Size: 44.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ad0fa4623d0e4b469804e8589ce2fc8a05fa420941316b0ea35b20f945c71ae |
|
MD5 | 2357edc9d5d194eb451412e51aa41a94 |
|
BLAKE2b-256 | 548551466aa6ea88865384f0e8a0d4bd2416290a85f2053d344771ad70cc091b |
Provenance
The following attestation bundles were made for pdfdeal-0.4.9-py3-none-any.whl
:
Publisher:
python-publish.yml
on Menghuan1918/pdfdeal
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pdfdeal-0.4.9-py3-none-any.whl
- Subject digest:
2ad0fa4623d0e4b469804e8589ce2fc8a05fa420941316b0ea35b20f945c71ae
- Sigstore transparency entry: 149418544
- Sigstore integration time:
- Predicate type: