Spaces:
Build error
Build error
File size: 283 Bytes
4dbe5d1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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')
|