Alfresco 文書を自動でPDF化メモ

OpenOffice連携と連携させるとPDF化ができそうだ。
修正ファイルは以下。
/usr/share/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/OOoDirect/default/openoffice-transform-context.xml
  • 変更前
<bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection" />
  • 変更後
<bean id="openOfficeConnection" >
    <constructor-arg type="java.lang.String" value="127.0.0.1"/>
    <constructor-arg type="int" value="8100"/>
</bean>

OpenOffice連携のためのスクリプトを作成し実行してデーモン化しておく

#!/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/lib/openoffice.org2.0/program'
SOFFICE_ARGS1="-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 1024x768x24 -fbdir /var/run"
XVFB_PIDFILE=/var/run/xvfb.pid
start_soffice() {
      echo -n $"Starting OpenOffice"
      $SOFFICE_PATH/soffice $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 5
      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