##############################
#    swftools的安装     #
##############################
1.安装所需的库和组件
yum install gcc* automake zlib-devel libjpeg-devel giflib-devel freetype-devel

2.下载并编译安装SWFTOOLS  
cd /usr/local/src
wget http://www.swftools.org/swftools-0.9.1.tar.gz
tar vxzf swftools-0.9.1.tar.gz
cd swftools-0.9.1
./configure --prefix=/usr/swftools
make
make install

============================================

编译错误:

安装过程中,出现如下错误及解决办法:

错误1:

***************************************************

* The following headers/libraries are missing:  ungif gif_lib.h

* Disabling gif2swf tool…

***************************************************

解决办法:

yum install giflib-devel

错误2:

***************************************************

* The following headers/libraries are missing: jpeglib t1lib ungif jpeglib.h freetype t1lib.h gif_lib.h

* Disabling pdf2swf tool…

* Disabling jpeg2swf tool…

* Disabling gif2swf tool…

***************************************************

解决办法:

yum install giflib-devel libjpeg-devel freetype-devel t1lib-devel

==========================================

3、设置swftools环境变量,使pdf2swf成为一个可执行命令

vi /etc/profile
export PATH=$PATH:/usr/local/swftools/bin/

执行下source /etc/profile 使环境变量生效。

4.安装xpdf语言包,下载xpdf-chinese-simplified.tar.gz文件,解压到/usr/local下,编辑add-to-xpdfrc文件,如下:
– 注:需要百度搜索下载xpdf-chinese-simplified.tar.gz 官方的下载太慢了。另外要将windows 字体库中的常用字体复制一份到/usr/share/fonts/win
vi /usr/local/xpdf-chinese-simplified/add-to-xpdfrc
fontDir /usr/share/fonts/win
displayCIDFontTT Adobe-GB1 /usr/share/fonts/win/simhei.ttf

swftools 对中文乱码问题

直接将windows系统的相关字体复制到linux字体目录下windows字体目录 c:\windows\fontslinux字体目录 /usr/share/fonts目前我只复制了以下字体

simfang.ttf 仿宋体

simhei.ttf 黑体

simkai.ttf 楷体

simsun.ttf 宋体和新宋体,原文件名simsun.ttc

tahoma.ttf tahoma字体

tahomabd.ttf tahoma字体的粗体形式

verdana.ttf verdana字体

verdanab.ttf verdana字体的粗体形式

verdanai.ttf verdana字体的斜体形式

verdanaz.ttf verdana字体的粗体+斜体形式 在CentOS目录里新建一个win文件夹

# mkdir /usr/share/fonts/win

# chmod 644 /usr/share/fonts/win/*将以上字体文件复制到/usr/share/fonts/win目录下执行

# mkfontscale

# mkfontdir # mkfont命令是生成win目录下所包含的字体的索引信息

# fc-cache # fc-cache命令更新字体缓存

# fc-cache -f –v

5、最后使用如下转换命令测试:
– 注:1.pdf是要存在的文件
//转化为swf
pdf2swf -s languagedir=/usr/local/xpdf-chinese-simplified -T 9 -s
poly2bitmap -s zoom=150 -s flashversion=9 “/usr/local/src/1.pdf” -o
“/usr/local/src/1.swf”

//转化为txt纯文本
pdftotext -q “/usr/local/src/1.pdf” “/usr/local/src/1.txt”

=================================================

##############################
#    openoffice的安装     #
##############################
1.安装OpenOffice
yum install openoffice.org-writer   
yum install openoffice.org-calc   
yum install openoffice.org-draw openoffice.org-impress

–注:文件安装在 /usr/lib/libreoffice/program 下面
启动openoffice服务

/usr/lib64/libreoffice/program/soffice.bin
“–accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager”
–norestore –nofirststartwizard –nologo –headless &

如果报错,则虚拟一个x桌面
Xvfb :2 -screen 0 800x600x24 2> /dev/null &

上面命令可能不执行,需要安装一个server
yum install xorg-x11-server-Xvfb

导入环境变量

export DISPLAY=localhost:0.0

2.安装OpenOffice SDK3.3
– wget http://ftp.nluug.nl/office/openoffice/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-rpm_en-US.tar.gz
tar -zxvf OOo-SDK_3.3.0_Linux_x86-64_install-rpm_en-US.tar.gz
cd OOO330_m20_native_packed-1_en-US.9567/RPMS/
rpm -ivh *.rpm –nodeps

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

用到ms office转换程序,需要启动一个服务监听程序,监听8100端口。可以通过设置让系统自动启动该服务。

1、创建一个执行脚本runoffice,内容如下
#vi /usr/sbin/runoffice
/usr/bin/nohup /usr/lib64/libreoffice/program/soffice.bin
“–accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager”
–norestore –nofirststartwizard –nologo –headless &
#chmod 775 /usr/sbin/runoffice
2、创建启动脚本
#cat  /etc/rc.d/rc.local

$ cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don’t
# want to do the full Sys V style init stuff.
xhost +
export     DISPLAY=:0.0
/usr/sbin/runoffice >/var/log/rc.local.log

touch /var/lock/subsys/local

上述脚本会在所有服务启动完之后执行。

注意

xhost +
export     DISPLAY=:0.0

要不然是不会启动成功的,会显示如下错误信息
/program/soffice.bin X11 error: Can’t open display:
  Set DISPLAY environment variable, use -display option
  or check permissions of your X-Server
  (See “man X” resp. “man xhost” for details)
加上那两行就会顺利启动了。

3、在 Centos上作为服务启动
经过一段时间的试用,发现2中的启动脚本有时能够成功,有时不能成功。
经过google搜索,有个服务启动脚本,经过修改以后,可以适用。

3.1 需要安装Xvfb,是一个虚拟XServer
In the X Window System, Xvfb or X virtual framebuffer is an X11 server
that performs all graphical operations in memory, not showing any screen
output. From the point of view of the client, it acts exactly like any
other server, serving requests and sending events and errors as
appropriate. However, no output is shown. This virtual server does not
require the computer it is running on to even have a screen or any input
device. Only a network layer is necessary.

它的图形只存在内存中,而不显示。

#yum seach Xvfb

#yum xorg-x11-server-Xvfb.x86_64

3.2 在/etc/init.d/创建服务启动脚本

下面是修改后适合Centos 6.3的 脚本内容

#cat /etc/init.d/soffice

#!/bin/bash

# Boot open office so that Alfresco can do transforms.
# chkconfig: 2345 55 25
# description: OpenOffice Headless
#
# processname: soffice

# source function library
. /etc/rc.d/init.d/functions

RETVAL=0

VDISPLAY=’99′
SOFFICE_PATH=’/usr/lib64/libreoffice/program/’
SOFFICE_ARGS1=”-nofirststartwizard -nologo -headless -display :$VDISPLAY ”
SOFFICE_ARGS2=’-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager’
SOFFICE_PIDFILE=/var/run/soffice.bin.pid

XVFB=/usr/bin/Xvfb
XVFB_ARGS=”:$VDISPLAY -screen 0 800x600x8 -fbdir /var/run”
XVFB_PIDFILE=/var/run/xvfb.pid
start_soffice() {
echo -n $”Starting OpenOffice”
$SOFFICE_PATH/soffice.bin $SOFFICE_ARGS1 $SOFFICE_ARGS2 >/dev/null 2>&1 &
[ $? -eq 0 ] && echo_success || echo_failure
pidof soffice.bin > $SOFFICE_PIDFILE
echo
}
start_xvfb() {
echo -n $”Starting Xvfb”
$XVFB $XVFB_ARGS >/dev/null 2>&1 &
[ $? -eq 0 ] && success || failure
pidofproc Xvfb > $XVFB_PIDFILE
echo
}
start() {
start_xvfb
sleep 3
start_soffice
}
stop() {
echo -n $”Stopping OpenOffice”
killproc soffice.bin
echo
echo -n $”Stopping Xvfb”
killproc Xvfb
echo
}
case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|restart}”
esac

#chkconfig soffice on

/etc/init.d/soffice start

##################################################

3.1 安装unoconv
wget http://pkgs.repoforge.org/unoconv/unoconv-0.5-1.el6.rf.noarch.rpm
rpm -ivh unoconv-0.5-1.el6.rf.noarch.rpm  –nodeps –force
或直接 yum install unoconv

查看之前安装的unoconv rpm 命令rpm -qa |grep -i unoconv 删除它用rpm -e unoconv-0.5-1.el6.rf.noarch
测试:
unoconv -help –nogpgcheck
//!!! 将某个txt转化为pdf !!!
unoconv -f pdf test.txt

 
hylafax会用到ms office转换程序,需要启动一个服务监听程序,监听8100端口。可以通过设置让系统自动启动该服务。

1、创建一个执行脚本runoffice,内容如下
#vi /usr/sbin/runoffice
/usr/bin/nohup /usr/lib64/libreoffice/program/soffice.bin
"--accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"
--norestore --nofirststartwizard --nologo --headless &
#chmod 775 /usr/sbin/runoffice
2、创建启动脚本
#cat  /etc/rc.d/rc.local

$ cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
xhost +
export     DISPLAY=:0.0
/usr/sbin/runoffice >/var/log/rc.local.log

touch /var/lock/subsys/local

上述脚本会在所有服务启动完之后执行。

注意

xhost +
export     DISPLAY=:0.0

要不然是不会启动成功的,会显示如下错误信息
/program/soffice.bin X11 error: Can't open display:
  Set DISPLAY environment variable, use -display option
  or check permissions of your X-Server
  (See "man X" resp. "man xhost" for details)
加上那两行就会顺利启动了。

3、在 Centos上作为服务启动
经过一段时间的试用,发现2中的启动脚本有时能够成功,有时不能成功。
经过google搜索,有个服务启动脚本,经过修改以后,可以适用。

3.1 需要安装Xvfb,是一个虚拟XServer

In the X Window System, Xvfb or X virtual framebuffer is an X11 server
that performs all graphical operations in memory, not showing any screen
output. From the point of view of the client, it acts exactly like any
other server, serving requests and sending events and errors as
appropriate. However, no output is shown. This virtual server does not
require the computer it is running on to even have a screen or any input
device. Only a network layer is necessary.

它的图形只存在内存中,而不显示。

#yum seach Xvfb

#yum xorg-x11-server-Xvfb.x86_64

3.2 在/etc/init.d/创建服务启动脚本

下面是修改后适合Centos 6.3的 脚本内容

#cat /etc/init.d/soffice

#!/bin/bash

# Boot open office so that Alfresco can do transforms.
# chkconfig: 2345 55 25
# description: OpenOffice Headless
#
# processname: soffice

# source function library
. /etc/rc.d/init.d/functions

RETVAL=0

VDISPLAY='99'
SOFFICE_PATH='/usr/lib64/libreoffice/program/'
SOFFICE_ARGS1="-nofirststartwizard -nologo -headless -display :$VDISPLAY "
SOFFICE_ARGS2='-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager'
SOFFICE_PIDFILE=/var/run/soffice.bin.pid

XVFB=/usr/bin/Xvfb
XVFB_ARGS=":$VDISPLAY -screen 0 800x600x8 -fbdir /var/run"
XVFB_PIDFILE=/var/run/xvfb.pid
start_soffice() {
echo -n $"Starting OpenOffice"
$SOFFICE_PATH/soffice.bin $SOFFICE_ARGS1 $SOFFICE_ARGS2 >/dev/null 2>&1 &
[ $? -eq 0 ] && echo_success || echo_failure
pidof soffice.bin > $SOFFICE_PIDFILE
echo
}
start_xvfb() {
echo -n $"Starting Xvfb"
$XVFB $XVFB_ARGS >/dev/null 2>&1 &
[ $? -eq 0 ] && success || failure
pidofproc Xvfb > $XVFB_PIDFILE
echo
}
start() {
start_xvfb
sleep 3
start_soffice
}
stop() {
echo -n $"Stopping OpenOffice"
killproc soffice.bin
echo
echo -n $"Stopping Xvfb"
killproc Xvfb
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
esac

#chkconfig soffice on

Centos上的安装openoffice+unoconv+swftools (转)的更多相关文章

  1. Cacti中文版在Centos上的安装

    最近老有人问Cacti中文版在哪下载啊怎么安装啊,我在这里一遍给大家讲解了:Cacti中文版在Centos上的安装 1.基本安装 cacti是运作在apache+php+mysql+net-snmp工 ...

  2. MongoDB 3.2 在CentOS 上的安装和配置

    MongoDB 3.2 在CentOS 上的安装和配置   2016-01-06 14:41:41 发布 您的评价:       0.0   收藏     0收藏 一.安装 编辑/etc/yum.re ...

  3. centos上yum安装异常处理

    最近在centos上通过yum来安装程序,出下了以下问题: Loaded plugins: fastestmirror Setting up Install Process Loading mirro ...

  4. Docker(1)在CentOS上的安装与卸载

     一. Docker的安装 CentOS7 上安装: 1. 卸载旧版本 $ sudo yum remove docker \ docker-client \ docker-client-latest ...

  5. CentOS上firefox安装flash

    CentOS下firefox安装flash说明 CentOS下自带了firefox,但没有flash插件的,按它自己的提示安装不成功,需要手动安装,如下: 1.打开flash官网,http://lab ...

  6. centos上如何安装mysql

    centos可以使用yum安装mysql 但是版本很低,且不灵活. 本文将介绍如何使用安装包安装mysql http://dev.mysql.com/downloads/mysql/ 下载mysql ...

  7. FastDFS在centos上的安装配置与使用

    FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题.特别适合以文件为载体的在线服务.(百 ...

  8. 转载:centos上yum安装apache+php+mysql等

    1. 更新系统内核到最新. [root@linuxfei ~]#yum -y update 系统更新后,如果yum安装时提示错误信息,请执行以下命令修复. [root@linuxfei ~]#rpm ...

  9. 在CentOS上编译安装PostgreSQL

    http://my.oschina.net/tashi/blog 第一步:准备阶段 获取必需软件包: CentOS中查看是否安装了某个软件的命令:rpm -qa | grep 软件名.which命令可 ...

随机推荐

  1. php中rsa加密解密验证

    RSA非对称加密,对敏感的数据传输进行数据加密.验证等.测试环境:wamp.aliyun虚拟主机(lamp)一.加密解密的第一步是生成公钥.私钥对,私钥加密的内容能通过公钥解密(反过来亦可以).下载生 ...

  2. iocp-socket 服务(借鉴别人的,根据自己的需要改的)未完待续

    #pragma once #include <WinSock2.h> #include <MSWSock.h> #include <Windows.h> #prag ...

  3. servlet定义

    . 运行在服务器上的java类

  4. quay.io/coreos/etcd 基于Docker镜像的集群搭建

    etcd是一个高可用的键值存储系统,主要用于共享配置和服务发现.etcd是由CoreOS开发并维护的,灵感来自于 ZooKeeper 和 Doozer,它使用Go语言编写,并通过Raft一致性算法处理 ...

  5. Oracle logmnr工具分析日志脚本

    在oracle:对logmnr工具分析日志这个不陌生:对数据恢复应用场景经常用到:这里为了方便对归档日志进行分析: 当然网上有一个logmnr界面的工具:感觉很人性化:下载需要积分:为此写一个脚本. ...

  6. transient关键字

    transient关键字的英文意思是:瞬态,由此可见是瞬间的,不可固定的. 会不会与对象的状态等等有关系呢? 网上找了一下资料是跟对象的序列化有关. transient的作用 一个对象只要实现了Ser ...

  7. Network-POJ3694并查集+LCA

    Network Time Limit: 5000MS   Memory Limit: 65536K       Description A network administrator manages ...

  8. [四校联考P3] 区间颜色众数 (主席树)

    主席树 Description 给定一个长度为 N 颜色序列A,有M个询问:每次询问一个区间里是否有一种颜色的数量超过了区间的一半,并指出是哪种颜色. Input 输入文件第一行有两个整数:N和C 输 ...

  9. grunt压缩合并代码

    module.exports = function(grunt) { // 配置 grunt.initConfig({ pkg : grunt.file.readJSON('package.json' ...

  10. caffe中python接口的使用

    下面是基于我自己的接口,我是用来分类一维数据的,可能不具通用性: (前提,你已经编译了caffe的python的接口) 添加 caffe塻块的搜索路径,当我们import caffe时,可以找到. 对 ...