def toArray(self, width=-1, height=-1, scale=1.): ''' render to image buffer in RGBA format ''' if CairoSVG is None: raise ImportError('cairo extension not available') svgfh = StringIO() self.write(svgfh) svgfh.seek(0) writer = CairoSVG(svgfh) return writer.toRGBA(width, height, scale)
def toArray(self, width = -1, height = -1, scale = 1.): ''' render to image buffer in RGBA format ''' if CairoSVG is None: raise ImportError('cairo extension not available') svgfh = StringIO() self.write(svgfh) svgfh.seek(0) writer = CairoSVG(svgfh) return writer.toRGBA(width, height, scale)
def writePDF(self, filename, width=-1, height=-1, scale=1.): ''' render to pdf file ''' if CairoSVG is None: raise ImportError('cairo extension not available') if isinstance(filename, basestring): fh = open(filename, 'wb') else: fh = filename svgfh = StringIO() self.write(svgfh) svgfh.seek(0) writer = CairoSVG(svgfh) writer.toPDF(fh, width, height, scale)
def writePDF(self, filename, width = -1, height = -1, scale = 1.): ''' render to pdf file ''' if CairoSVG is None: raise ImportError('cairo extension not available') if isinstance(filename, basestring): fh = open(filename, 'wb') else: fh = filename svgfh = StringIO() self.write(svgfh) svgfh.seek(0) writer = CairoSVG(svgfh) writer.toPDF(fh, width, height, scale)