使用java获取网页的屏幕截图

时间:2017-01-02 09:28:36

标签: java api

我试图使用java代码截取网页的截图。我正在使用谷歌api获取截图。但它只有有限的报价而不是免费的。任何人都可以帮助我获取代码

1 个答案:

答案 0 :(得分:0)

在网页中,您可以在HTML 5中使用html2canvas

有关详情,请阅读here

这样的事情:

  

要在带有一些选项的元素上运行html2canvas,只需调用:

html2canvas(element, options);
     

渲染的画布在onrendered的回调事件中提供,如   这样:

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

有关详细信息,请参阅:https://html2canvas.hertzen.com/documentation.html

为此,Java阅读此answer