lamp下仿百度文库

现在,openoffice的发展势头已经由libreoffice接过来了。希望你用libreoffce试一试。直接使用命令行就行了,例如libreoffice --invisible --convert-to pdf:writer_pdf_Export --outdir /home/me /home/me/test.doc详细命令参数请看帮助--help
用tab键补全命令!
libreoffice命令因为不同的版本有所不同。如果是新的4.0版,命令应该是libreoffice4.0:libreoffice4.0 --invisible --convert-to pdf:writer_pdf_Export --outdir /home/me test.doc








安装X图形界面
#可查询哪些组件是否已经安装(可用来对照组件名称)


yum grouplist




#安装X图形界面系统 


yum list 列出所有可安装的软件包 可以通过 yum grouplist 来查看可能批量安装哪些列表 比如 #yum groupinstall "DNS Name Server" //安装 bind 及 bind-chroot 套件


yum groupinstall 'X Window System' -y


配置虚拟桌面


yum install Xvfb
Xvfb :1 -screen 0 800x600x24&
export DISPLAY=localhost:1


运行soffice服务


yum install libreoffice
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &


文档转为Pdf(支持多种格式)


yum install http://pkgs.repoforge.org/unoconv/unoconv-0.5-1.el6.rf.noarch.rpm  


/usr/bin/unoconv -f pdf test.doc


pdf转为swf


1.  下载:http://www.swftools.org/download.html
 wget http://www.swftools.org/swftools-0.9.2.tar.gz


解决在CentOS 5.5 64bit 下编译安装失败需要先安装如下软件。


#  yum -y install giflib-devel libjpeg-devel freetype-devel t1lib-devel zlib
#  yum install gcc gcc-c++


2.  安装swftools


# tar -xzvf swftools-0.9.2.tar.gz


# cd swftools-0.9.2


# ./configure 


# make


# make install




/usr/local/bin/pdf2swf -t test.pdf -o test.swf -s flashversion=9




php下使用C语言提权使php以root权限运行命令


doc2swf:


首先写个C程序,命名为:run.c
#include <stdio.h> 
#include <stdlib.h> 
#include <sys/types.h> 
#include <unistd.h> 
int main() 

uid_t uid ,euid; 
//char cmd[1024]; //变量暂时未使用 
uid = getuid() ; 
euid = geteuid(); 
printf("my uid :%u\n",getuid()); //这里显示的是当前的uid 可以注释掉. 
printf("my euid :%u\n",geteuid()); //这里显示的是当前的euid 
if(setreuid(euid, uid)) //交换这两个id 
perror("setreuid"); 
printf("after setreuid uid :%u\n",getuid()); 
printf("afer sertreuid euid :%u\n",geteuid()); 
system("/usr/bin/unoconv -f pdf test.doc"); //执行脚本 
return 0; 



编译该文件: 
gcc -o run -Wall run.c 
在该路径下生成run文件,这个可执行文件。如果现在用PHP脚本调用 该run的话,即使setreuid了 也是不行的。 
接下来要做的是:给run赋予suid权限 
chmod u+s run 


使用php页面调用它
<?php 
echo '<pre>'; 
$last_line = system('/var/www/html/run', $retval); 
echo ' 
</pre> 
<hr />Last line of the output: ' . $last_line . ' 
<hr />Return value: ' . $retval; 
?> 
如果转换不成功,可能是selinux未关闭,关闭selinux就可以了。


pdf2swf:


<?php
$command="/usr/local/bin/pdf2swf -t test.pdf -o test.swf -s flashversion=9";
echo $command;
echo "<br>";
exec($command ." 2>&1",$output,$return_val);
print_r($output);
?>






flexpaper播放


wget http://flexpaper.googlecode.com/files/FlexPaper_1.4.5_flash.zip


解压缩后有个index.html是示例,用到的文件是


flexpaper/js/flexpaper_flash.js
flexpaper/FlexPaperViewer.swf
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值