Handle PDF more easily and simply, utilizing Doc2X's powerful document conversion capabilities for retained format file conversion/RAG enhancement.
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.
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.
pdfdeal
also provides a series of powerful tools to handle Markdown documents:
- Convert HTML tables to Markdown format: Allows conversion of HTML formatted tables to Markdown format for easy use in Markdown documents.
- Upload images to remote storage services: Supports uploading local or online images in Markdown documents to remote storage services to ensure image persistence and accessibility.
- Convert online images to local images: Allows downloading and converting online images in Markdown documents to local images for offline use.
- Document splitting and separator addition: Supports splitting Markdown documents by headings or adding separators within documents for better organization and management.
For detailed feature introduction and usage, please refer to the documentation link.
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.
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.
For details, please refer to the documentation
Or check out the documentation repository pdfdeal-docs.
For details, please refer to the documentation
Install using pip:
pip install --upgrade pdfdeal
If you need document processing tools:
pip install --upgrade "pdfdeal[rag]"
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)
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.