A lightweight Python service for converting PDF files into images using pdftoppm. It generates one PNG image per page in the PDF.
- Converts PDF files to PNG images.
- Outputs one image per page in the PDF.
- Lightweight and easy to use.
- Python 3.7 or higher.
pdftoppminstalled on the system (part ofpoppler-utils).
-
Clone the repository:
git clone https://github.com/m-ah07/PDF-to-Images-Conversion-python.git
-
Install
pdftoppm(if not already installed):sudo apt install poppler-utils
Use the provided example script in the examples/ directory:
from src.pdf_to_images import PdfToImages
pdf_path = "sample.pdf"
output_dir = "output"
converter = PdfToImages(pdf_path, output_dir)
images = converter.convert()
print(images)Place a sample PDF in the examples/ folder and run the script:
python examples/example.pyPDF-to-Images-Conversion-python/
βββ examples/
β βββ example.py
βββ src/
β βββ pdf_to_images.py
βββ LICENSE
βββ .gitignore
βββ README.md
Contributions are welcome! Feel free to submit a pull request or open an issue to report bugs or suggest features.
If you found this project helpful, please consider giving it a β on GitHub. Your support means the world to us!