You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
391 B
Python
16 lines
391 B
Python
from pdf2image import convert_from_path
|
|
import os
|
|
|
|
|
|
def qietu(fname):
|
|
dirname = fname.rsplit('.', 1)[0]
|
|
if not os.path.exists(dirname):
|
|
os.mkdir(dirname)
|
|
images = convert_from_path(fname, fmt='png', output_folder=dirname, poppler_path=r'/opt/homebrew/Cellar/poppler/23.10.0/bin')
|
|
|
|
return images
|
|
|
|
|
|
if __name__ == '__main__':
|
|
pdfile = 'huanbu.pdf'
|
|
qietu(pdfile) |