Spaces:
Build error
Build error
| 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') | |