App / full_code.py
LinhKL2002's picture
Upload folder using huggingface_hub
4dbe5d1 verified
import os
from pdf2image import convert_from_path
# Path to your PDF file
pdf_path = 'example.pdf'
# Convert PDF to images
images = convert_from_path(pdf_path, dpi=300)
# Save each page as an image
for i, image in enumerate(images):
image.save(f'page_{i + 1}.jpg', 'JPEG')