centos下:(主要参考http://loosky.net/2816.html)

(1)安装qt47

增加qt47的源

vim /etc/yum.repos.d/atrpms.repo

//加入如下内容
[atrpms]
name=CentOS $releasever – $basearch – ATrpms
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1
enabled=1 [atrpms-testing]
name=CentOS $releasever – $basearch - ATrpms testing
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/testing
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1
enabled=1 //进行安装
yum update
yum install qt47
yum install qt47-devel
yum install qt47-webkit
yum install qt47-webkit-devel

2、安装cutycapt

yum install svn
svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt
mv cutycapt/CutyCapt /usr/local/cutycapt
cd /usr/local/cutycapt
qmake
qmake-qt47 这一步我遇到俩问题:
1)、svn co时没拉下来代码,把这个地址直接在浏览器里访问时,发现跳转到了https://svn.code.sf.net/p/cutycapt/code/,把地址改成这个后,用svn拉下了code的文件夹,然后mv code/CutyCapt /usr/local/cutycapt
2)、到qmake时,提示commond not found,百度查说用locate qmake查路径,我去!又提示locate 没这个命令,再查 windows和centos用cutycapt截网页的图-LMLPHP
按上面的方法装了mlocate,后查到qmake的路径
windows和centos用cutycapt截网页的图-LMLPHP 可以用echo $PATH查看系统变量,
windows和centos用cutycapt截网页的图-LMLPHP
再创建软链接指向到/usr/local/bin:
windows和centos用cutycapt截网页的图-LMLPHP
这时就能用qmake命令了,主要参考这个网址:http://blog.sina.com.cn/s/blog_4a94a0db0100sxnt.html

3、安装xvfb

yum install Xvfb

4、测试cutycapt截图

xvfb-run --server-args="-screen 0, 1024x768x24" CutyCapt --url=http://www.baidu.com --out=baidu.png
这一步在拉下来的代码里,我这的错误提示,说什么CutyCapt找不到,在上述命令里的
CutyCapt改成 ./CutyCapt就好了
到最后截图:

windows和centos用cutycapt截网页的图-LMLPHP

乱码,把c:/windows/fonts下的字体传几个到/usr/share/fonts下,再用fc-cache,再执行上面截图的命令就好了
结果:windows和centos用cutycapt截网页的图-LMLPHP windows下把cutyCapt的路径写好,system调用就好
 
 
04-19 13:05