vb.net - Convert SVG or Base30 to image file -


i'm trying convert svg file format of image file. i'm creating svg file base30 value.

public sub savesignature()     dim b30 new base30converter      dim img = b30.getdata("aq4895d6d7j5h94840z39baa6bfb6430y4538d6a49c59db8863003240z4374b7ek7j4a33y255e8j5d6z52y3b2428385e9n1vd1bfq6a4z4y3949456z1e91wi2b2n1u2eh1h9by5j81ye1w1u8e5724983329d8pe1ai1nf1v1uft9d5_7wz266594c4g7gc36452542000y2648a67334524112100z1235766y64z9ah593420y75g7d483401000z34y133z332y7e29262300z43a3652y26252556400z2ig6h2200473720y2263542006736424241000z826010")     dim svg = svgconverter.tosvg(img)      dim sw new system.io.streamwriter("d:\sign.svg", false)     sw.write(svg)     sw.close()     dim bmp bitmap = renderfile("d:\sign.svg")     dim g graphics     g = graphics.fromimage(bmp)     using g         g.clear(color.white)         g.drawimageunscaled(bmp, 0, 0)     end using     bmp.save("d:\sign.bmp", system.drawing.imaging.imageformat.bmp)     bmp.save("d:\sign.jpg", system.drawing.imaging.imageformat.jpeg)     bmp.save("d:\sign.emf", system.drawing.imaging.imageformat.emf) end sub  public function renderfile(filename string) bitmap     dim displaysize system.drawing.size     displaysize.width = 300     displaysize.height = 200     dim svgdoc svgdocument = svgdocument.open(filename)     dim svgsize = svgdoc.getdimensions()      if svgsize.width = 0         throw new exception("svg not have size specified. cannot work it.")     end if      dim displayproportion = (displaysize.height * 1.0f) / displaysize.width     dim svgproportion = svgsize.height / svgsize.width      dim scalingfactor single = 0.0f     dim padding integer = 10      if displayproportion > svgproportion         scalingfactor = ((displaysize.width - padding * 2) * 1.0f) / svgsize.width     else         scalingfactor = ((displaysize.height - padding * 2) * 1.0f) / svgsize.height     end if      if scalingfactor < 0         throw new exception("viewing area small render image")     end if      dim centeringx integer = convert.toint16((displaysize.width - (padding + cint(svgdoc.width) * scalingfactor)) / 2)     dim centeringy integer = convert.toint16((displaysize.height - (padding + cint(svgdoc.height) * scalingfactor)) / 2)      svgdoc.transforms = new svgtransformcollection()     svgdoc.transforms.add(new svgtranslate(padding + centeringx, padding + centeringy))     svgdoc.transforms.add(new svgscale(scalingfactor))     svgdoc.width = new svgunit(svgdoc.width.type, displaysize.width)     svgdoc.height = new svgunit(svgdoc.height.type, displaysize.height)     return svgdoc.draw() end function 

after these process image file left empty file.

the base30 value i'm getting signature panel in asp application.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -