Linux conversor: png to pdf.
import os
import subprocess
# i/o
folder_input = 'xxx'
folder_output = 'xxx'
# key selection
skey = '-xxx.png'
# collect input files
lfiles = [ifile for ifile in os.listdir(folder_input) if skey in ifile]
# loop of input files
for ifile in lfiles:
print('- conversion: %s --> %s'%(ifile,ifile.replace('png','pdf')))
path_input = os.path.join(folder_input,ifile)
path_output = os.path.join(folder_output,ifile.replace('png','pdf'))
scommand = 'convert %s %s'%(path_input,path_output)
try:
_ = subprocess.call(scommand, shell=True)
except Exception as e:
print(str(e))