Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Uses convert cmdline tool
- import os
- def main():
- dir_list = os.listdir('./pdfs') # change to your pdf directory
- for full_file_name in dir_list:
- base_name, extension = os.path.splitext(full_file_name)
- if extension == '.pdf': # then .pdf file --> convert to image!
- cmd_str = ' '.join(['convert',
- '"./pdfs/' + full_file_name + '"', # change to your pdf directory
- '"' + base_name + '.png"'])
- print(cmd_str) # echo command to terminal
- os.system(cmd_str) # execute command
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement