Converting multiple SVG files to PDF in Python?
georgereynolds (0)

I have a python 3 script which uses 'convert' (a unix/linux utliity) to convert multiple SVG files to a single PDF file. Works very well from my Windows 10 box using the Ubuntu Linux command line, but not in

Any alternatives or tips ?

I've seen python SVG convert utilities but not sure if any work with multiple SVG files to one PDF file

def convert_to_pdf():
    print("Tidying files...")
    print("Converting to PDF (can take a while)...")
    cmd = 'convert '+str(directory_in_str)+'/*.svg '+str(directory_in_str)+'/'+str(magid)+"_"+str(issueid)+'.pdf'
    returned_value =, shell=True)  # returns the exit code in unix
    print('PDF conversion process ended with value: ', returned_value)
    if returned_value == 0:
        print('PDF conversion completed OK')
        print ('PDF conversion failed?')
You are viewing a single comment. View All
PaoloAmoroso (118)

@georgereynolds there are good image and file conversion libraries in PyPI but I'm afraid I haven't tried any yet.