canvg

merge images from Raphael svg

泪湿孤枕 提交于 2019-12-10 12:32:31
问题 Trying to create Step 1 - Let users upload images through Ajax, Raphael and Raphael freetransform. Step 2 - Click button to show one image from merge upload images. (Question): I have found similar post about convert Raphael svg 1 2 3, so I'm using Canvg too but get console.log: Resource interpreted as image but transferred with MIME type text/html error: image "" not found . Please help me find how to solve it. or any clue how to reach same goal(convert several Raphael svg images from upload

draw svg to canvas with canvg

心已入冬 提交于 2019-12-10 10:16:58
问题 I use canvg for set svg file in canvas. All is ok when I set svg url: var canvas = doc.getCanvas(num); var context = canvas.getContext('2d'); context.drawSvg("http://localhost:8084/manual.svg", 0, 0, width, height); But when I try to write (it doesn't work): context.drawSvg("data:image/svg+xml,"+svg, 0, 0, width, height); where variable svg get manual.svg content. 回答1: img.src = "data:image/svg+xml;base64,"+btoa(svgContent); context.drawImage(img, 0, 0, width, height); it's one variant to

Styling errors when converting inline SVG to png

≯℡__Kan透↙ 提交于 2019-12-07 16:54:05
问题 My high level goal is to convert a <div> element containing a few inline svg images to a png file. All operations must be performed within the client browser using JavaScript. I have tried: using canvg library and following the steps from this post: https://github.com/niklasvh/html2canvas/issues/95#issuecomment-34439223 original svg: result: flattening the css styles into the <svg> tag and then calling canvg, following the steps from this post: Convert embedded SVG to PNG in-place result: a

canvg doesn't work with svg already placed in body?

我们两清 提交于 2019-12-06 08:22:34
问题 I want to converty my SVG into CANVAS and then save it as image. I have svg already genereated by javascript in my page. I use this code: $("#menu-save-image").click(function () { var svg = document.getElementsByTagName('svg'); var canvas = document.getElementById("test"); canvg(canvas, svg); // or second way var c = document.getElementById('test'); var ctx = c.getContext('2d'); ctx.drawSvg(svg, 0, 0, 500, 500); }); Both ways doesn't work. Why? 回答1: canvg method needs SVG source string (or

draw svg to canvas with canvg

别等时光非礼了梦想. 提交于 2019-12-06 01:21:56
I use canvg for set svg file in canvas. All is ok when I set svg url: var canvas = doc.getCanvas(num); var context = canvas.getContext('2d'); context.drawSvg("http://localhost:8084/manual.svg", 0, 0, width, height); But when I try to write (it doesn't work): context.drawSvg("data:image/svg+xml,"+svg, 0, 0, width, height); where variable svg get manual.svg content. img.src = "data:image/svg+xml;base64,"+btoa(svgContent); context.drawImage(img, 0, 0, width, height); it's one variant to solve the problem. 来源: https://stackoverflow.com/questions/12899053/draw-svg-to-canvas-with-canvg

Styling errors when converting inline SVG to png

陌路散爱 提交于 2019-12-05 19:26:50
My high level goal is to convert a <div> element containing a few inline svg images to a png file. All operations must be performed within the client browser using JavaScript. I have tried: using canvg library and following the steps from this post: https://github.com/niklasvh/html2canvas/issues/95#issuecomment-34439223 original svg: result: flattening the css styles into the <svg> tag and then calling canvg, following the steps from this post: Convert embedded SVG to PNG in-place result: a blank image. flattening the css styles into the <svg> tag and manually drawing the svg onto a canvas,

Dotted line in pdf file with IE 10

半城伤御伤魂 提交于 2019-12-02 22:07:54
问题 The graph is the same and correct on browser, Chorme, IE11, IE10, etc.... In IE 11, I press a button to create png file, the result is correct. In IE 10, I press a button to create png file, the result is incorrect, the dotted line of graph change to solid line. I have no idea about this problem, can anyone help me? IE 11: (source: 2.pik.vn) IE 10: (source: 2.pik.vn) This is the code i use to convert from svg to canvas: var svg = document.getElementById("graphP").innerHTML; var canvas =

Dotted line in pdf file with IE 10

谁说我不能喝 提交于 2019-12-02 09:47:07
The graph is the same and correct on browser, Chorme, IE11, IE10, etc.... In IE 11, I press a button to create png file, the result is correct. In IE 10, I press a button to create png file, the result is incorrect, the dotted line of graph change to solid line. I have no idea about this problem, can anyone help me? IE 11: (source: 2.pik.vn ) IE 10: (source: 2.pik.vn ) This is the code i use to convert from svg to canvas: var svg = document.getElementById("graphP").innerHTML; var canvas = document.getElementById("canvas"); canvg(canvas, svg); var imgDataP = canvas.toDataURL(); 来源: https:/

Convert SVG to image in PNG

无人久伴 提交于 2019-11-30 09:54:13
问题 i am converting angular nvd3 chart to svg using html2canvas and canvg plugings but when i convert pie chart to png then i looks same as chart but when i convert line chart or area chart then its background goes to black and some circle drown on image. My code is var svgElements = $("#container").find('svg'); //replace all svgs with a temp canvas svgElements.each(function () { var canvas, xml; // canvg doesn't cope very well with em font sizes so find the calculated size in pixels and replace

Canvas generated by canvg is blurry on retina screen

眉间皱痕 提交于 2019-11-27 15:14:02
问题 I'm using Raphael to draw an object, then transferring it to an HTML canvas element with canvg so that I can use toDataURL to save it as a PNG. But when I use canvg, the resulting image is blurry. The code below, for example, produces this (raphael on top, canvg on bottom): <html> <head> <script src="lib/raphael-min.js"></script> <script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script> <script type="text/javascript" src="http://canvg.googlecode.com/svn