Linux webkit截图,CutyCapt 跨平台使用 WebKit 内核网页截图工具 - 文章教程

CutyCapt 是一个跨平台的命令行工具,用来捕获 WebKit 内核渲染的页面,可生成各种矢量图和位图格式,包括 PDF、SVG、PNG、JPEG、PS、TIFF、GIF、BMP 等。和 IECapt 差不多的功能,后者是一种基于 Internet Explorer 类似的网页截图工具。

局限性

CutyCapt 使用的时候还是有一些差异,并不是真正的浏览网页然后再保存,和我们看到的网页可能有些不同,例如部分需要浏览器插件才能完成的功能,他并不能在某些平台上完全被渲染出来。

安装依赖

在 Linux 上,CutyCapt 依赖于 Qt 4.4.0+,在 Windows 上无需安装,解压即可使用非常方便。

下载地址

Windows 版本

源代码

使用方法

打开命令提示符输入 –help 获取帮助:

CutyCapt --help

-----------------------------------------------------------------------------

Usage: CutyCapt --url=http://www.example.org/ --out=localfile.png

-----------------------------------------------------------------------------

--help Print this help page and exit

--url= The URL to capture (http:...|file:...|...)

--out= The target file (.png|pdf|ps|svg|jpeg|...)

--out-format= Like extension in --out, overrides heuristic

--min-width= Minimal width for the image (default: 800)

--min-height= Minimal height for the image (default: 600)

--max-wait= Don't wait more than (default: 90000, inf: 0)

--delay= After successful load, wait (default: 0)

--user-style-path= Location of user style sheet file, if any

--user-style-string= User style rules specified as text

--header=: request header; repeatable; some can't be set

--method= Specifies the request method (default: get)

--body-string= Unencoded request body (default: none)

--body-base64= Base64-encoded request body (default: none)

--app-name= appName used in User-Agent; default is none

--app-version= appVers used in User-Agent; default is none

--user-agent= Override the User-Agent header Qt would set

--javascript= JavaScript execution (default: on)

--java= Java execution (default: unknown)

--plugins= Plugin execution (default: unknown)

--private-browsing= Private browsing (default: unknown)

--auto-load-images= Automatic image loading (default: on)

--js-can-open-windows= Script can open windows? (default: unknown)

--js-can-access-clipboard= Script clipboard privs (default: unknown)

--print-backgrounds= Backgrounds in PDF/PS output (default: off)

--zoom-factor= Page zoom factor (default: no zooming)

--zoom-text-only= Whether to zoom only the text (default: off)

--http-proxy= Address for HTTP proxy server (default: none)

-----------------------------------------------------------------------------

is svg,ps,pdf,itext,html,rtree,png,jpeg,mng,tiff,gif,bmp,ppm,xbm,xpm

-----------------------------------------------------------------------------

编译源代码

% sudo apt-get install subversion libqt4-webkit libqt4-dev g++

% svn co svn://svn.code.sf.net/p/cutycapt/code/ cutycapt

% cd cutycapt/CutyCapt

% qmake

% make

% ./CutyCapt --url=http://www.example.org --out=example.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值