Closed g444ran closed 4 years ago
i was able to get it to work loading like this where rootdir is in the format 'C://some_pdfs_folder//'
for root, subFolders, files in os.walk(rootdir):
for file in files:
theFile = os.path.join(root,file)
fileName, fileExtension = os.path.splitext(theFile)
if fileExtension.lower() in ('.pdf'):
try:
File = pdf2jpg.convert_pdf2jpg(theFile,pdf_output,pages="ALL")
here theFile is the rootdir path+somefile.pdf and pdf_output is some other folder below rootdir
this routine works for a lot of pdf producer types, but fails on certain types not closed/finalized properly throwing the common java memory exception.
Try to check if you have java in your system, because the system is based on jar manipulation.
seems like duplicate of https://github.com/pankajr141/pdf2jpg/issues/7 Hence closing
Executing the below: from pdf2jpg import pdf2jpg inputpath = r'D:\sample.pdf'
outputpath = r'D:\image.jpg'
To convert single page
result = pdf2jpg.convert_pdf2jpg(inputpath, outputpath, dpi=300, pages="ALL")
print(result)
Error I get: [WinError 2] The system cannot find the file specified False