Skip to main content

A package for extracting images, texts and tables from pdfs

Project description

PDF Text & Image Extractor

A robust Python-based utility designed to extract text, tables, and images from PDF documents. This tool supports both local file systems and Amazon S3, utilizing multi-threading to speed up the extraction process.

🚀 Features

  • Hybrid Storage Support: Seamlessly process PDFs from local paths or S3 buckets (s3://...).
  • Comprehensive Extraction:
    • Text: Full-page text extraction.
    • Tables: Structured table data.
    • Images: High-fidelity image extraction.
  • Multi-threaded Performance: Extracts text and images in parallel to significantly reduce processing time.
  • Cloud Ready: Built-in methods to save results directly back to S3 as JSON and PNG files.

🛠 Installation

1. Clone the repository

pip install pdf_text_image_xtract

Basic Example Usage

from pdf_text_image_xtract import PDFTextImageExtractor

# Initialize the extractor with a local path
extractor = PDFTextImageExtractor("documents/report.pdf")

# Process the PDF (runs text and image extraction in parallel)
extractor.process()

# Save results to local disk
extractor.save_text_data_to_json("output/data.json")
extractor.save_images_to_disk("output/extracted_images")

Cloud Example (AWS S3)

from pdf_text_image_xtract import PDFTextImageExtractor

# Initialize with an S3 path
s3_path = "s3://my-bucket/input/document.pdf"
extractor = PDFTextImageExtractor(s3_path)

# Extract data
extractor.process()

# Upload results directly back to S3
extractor.save_text_data_to_json_s3(
    bucket_name="my-bucket",
    object_key="results/text_data.json",
)

extractor.save_images_to_s3(
    bucket_name="my-bucket",
    folder="results/images",
)

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

pdf_text_image_xtract-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_text_image_xtract-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pdf_text_image_xtract-0.1.0.tar.gz.

File metadata

  • Download URL: pdf_text_image_xtract-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for pdf_text_image_xtract-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e20862923150c08f7aaa3209df931fa09f1b1cc36c85d5138a81358d070121d9
MD5 8142ec2cd3903579b51c7ced7cb9c344
BLAKE2b-256 989d0d9ae2f3bb28957f72c8adf85cb80d44c1203769d44b204c9ed25e7772d2

See more details on using hashes here.

File details

Details for the file pdf_text_image_xtract-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pdf_text_image_xtract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac6cb3b3a1bb67eec731541a1a7c44a3793b928ffb4aafaa811af18fa35fd455
MD5 05a23b8427d9e4fb193821d2727cf345
BLAKE2b-256 a9bb394747dec9058f351b8e0dae18f553bb1f3f15e6fb1d9c582cee7dd76dee

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