我正在使用perl模块Gtk2::WebKit创建浏览器并截取网页截图.截取页面可见部分的屏幕截图(窗口大小)没有问题.但是,如何拍摄整页的屏幕截图,甚至是窗口中不可见的部分?
我想这就是你要找的。我在 Github 上找到了它。
Screenshot.pl - 截取屏幕截图
将页面另存为 SVG:
screenshot.pl --type svg http://www.google.com/
Run Code Online (Sandbox Code Playgroud)
将页面另存为 PDF:
screenshot.pl --output cpan.pdf http://search.cpan.org/
Run Code Online (Sandbox Code Playgroud)
将从 XPath 查询中获取的页面元素保存为 PNG:
screenshot.pl --output ba.png --xpath 'id("content")' http://bratislava.pm.org/
Run Code Online (Sandbox Code Playgroud)