2017-01-02 69 views
1

我試圖用java代碼截取網頁截圖。我使用谷歌API來獲取screenshot.But它只有有限的報價,而不是free.Can誰能幫助我獲得代碼使用java拍攝網頁截圖

+0

你可以使用phantomjs – AdamSkywalker

+0

http://stackoverflow.com/a/7583391/1475228 –

回答

0

在一個網頁,你可以在HTML 5

使用html2canvas更多你可以閱讀here

事情是這樣的:

要使用一些選項元素上運行html2canvas只需撥打:

html2canvas(element, options); 

呈現的畫布在onrendered回調事件提供,如 例如:

html2canvas(element, { 
    onrendered: function(canvas) { 
     // canvas is the final rendered <canvas> element 
    } 
}); 

欲瞭解更多信息,請閱讀他re:https://html2canvas.hertzen.com/documentation.html

這樣做Java讀取這個answer