2
如何將<div id="container"></div>
的內容保存爲圖像文件?將div標籤的內容保存到圖像文件中
編輯:此頁面包含一個jQuery腳本,使該標記containt顯示圖表。我在這裏試圖將生成的包含文件保存到另一個網頁後保存到圖像文件中。
在此先感謝!
如何將<div id="container"></div>
的內容保存爲圖像文件?將div標籤的內容保存到圖像文件中
編輯:此頁面包含一個jQuery腳本,使該標記containt顯示圖表。我在這裏試圖將生成的包含文件保存到另一個網頁後保存到圖像文件中。
在此先感謝!
退房html2canvas - Screenshots with JavaScript
您還可以使用:
var c = document.getElementById('the_canvas_element_id');
var t = c.getContext('2d');
/* then use the canvas 2D drawing functions to add text, etc. for the result */
,然後打開一個新的標籤與快照使用:
window.open('', document.getElementById('the_canvas_element_id').toDataURL());
感謝您的回覆,但是,如何將其保存到本地文件中? – ABCmo
你的意思是將文本轉換爲圖像..? – Gautam3164
@ user3319426請舉一些例子或更多的細節,我們不能幫助你,因爲我們不明白你想要什麼.. – STP38
@ Gautam3164,我已經更新了我的文章。 – ABCmo