2

I have code that converts PDFs to PNG files successfully on almost all PDFs, but I've been trying to convert this one, and it only saves blank images of each page.

Note that I am using Windows 10 to do this. I can successfully get pdf2image to output the correct images on Mac OS.

Here is my code:

import pdf2image
pdf_path = 'reliefsocietymag01reli.pdf'
info = pdf2image.pdfinfo_from_path(pdf_path, userpw=None, poppler_path='C:/Program Files/poppler-0.68.0/bin')
page_count = info['Pages']
for page_number in range(1, page_count+1):
    pages = pdf2image.convert_from_path(pdf_path, dpi=300, first_page=page_number, last_page=page_number+1, poppler_path='C:/Program Files/poppler-0.68.0/bin')
    pages[0].save(f'test - {page_number}.png', 'PNG')

1 Answers1

0

I figured out my own problem. It is a problem with Windows that can't really be debugged within the scope of Python. Using a Mac fixed my problem.