python - SVG to PDF using svglib -


i trying convert svg pdf in python using svglib , reportlab.so,i installed both of these,and following example on site , ran is,like below.

>>> svglib.svglib import svg2rlg >>> reportlab.graphics import renderpdf >>> drawing = svg2rlg("svgmonitor.svg") failed load input file! 

i error failed load input file!.please suggest problem?

the svg file trying convert valid file, , has enough permissions.

using python 2.6

posting answer because long:

this function call:

# http://philip-tzou-code-art.googlecode.com/svn/trunk/pdf/svglib.py def svg2rlg(path):     "convert svg file rlg drawing object."      # load svg file     try:         doc = xml.dom.minidom.parse(path)         svg = doc.documentelement     except:                         # try except bad thing         print "failed load input file!"         #return      # convert rlg drawing     svgrenderer = svgrenderer(path)     svgrenderer.render(svg)     drawing = svgrenderer.finish()      return drawing 

try try , except removed. do?


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -