-1
誰能告訴我爲什麼我的svg不能下載?我究竟做錯了什麼?我似乎無法找到如何將我的svg下載到png的解決方案。是我的圖書館還是我的代碼?不能下載我的png
function save(){
$("#editor_save").click(function() {
// the canvg call that takes the svg xml and converts it to a canvas
canvg('canvas', $("#editor").html());
// the canvas calls to output a png
var canvas = document.getElementById("canvas");
var img = canvas.toDataURL("image/png");
// do what you want with the base64, write to screen, post to server, etc...
});
}
<script src="canvg-master/canvg.js"></script>
<div id="editor" class="chart">
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="red" />
</svg><br />
<button id="editor_save" onclick="save">Save</button>
</div>
嘿羅伯特感謝您的答案,但我怎麼把它保存到我的瀏覽器,當你點擊保存,你必須將其保存到我的瀏覽器你怎麼做, – Jonty
HTTP:// stackoverflow.com/questions/2483919/how-to-save-svg-canvas-to-local-filesystem –
嘿羅伯特Im新的jquery不能你編輯我的代碼中的解決方案請 – Jonty