Thanks

Comments

ZyanKLee’s picture

It does indeed:
- use dev versions of bitcache, ff and rdf
- install libreoffice
- use jodconverter 3.x.x from http://code.google.com/p/jodconverter/
- change the -f parameter in the converters list to -o
i.e.: {localhost:8100}{mv} "[in_file]" "[in_file].doc"; {java} -jar {{/opt/jodconverter/jodconverter.jar}} -o pdf "[in_file].doc"; {mv} "[in_file].doc" "[in_file]"; {mv} "[in_file].pdf" "[out_file]"

jvieille’s picture

Status: Active » Needs work

Just need to be included in the documentation.

Thanks!

johanneshahn’s picture

Status: Needs work » Closed (fixed)

added to Mdoule Description page.
added a FURTHER INFORMATION section in README.txt for issues like that

jvieille’s picture

Status: Closed (fixed) » Active

added a FURTHER INFORMATION section in README.txt for issues like that
what I found in README.txt is

FURTHER INFORMATION
-------------------
ISSUE http://drupal.org/node/1105122 - Would FF work with LibreOffice?

Looks like a circular definition, not really useful.
Apart from the fact that OpenOffice changes hands and becomes a unrecommended choice, Libreoffice is known to much better handle file conversion than Openoffice.

I actually often observe erratic conversion : need to re-run conversion, reload files, clear failed conversion... Uploading more than one file at a time generally result in failed conversion. Maybe Libreoffice would improve that?

How one can practically switch from Openoffice to Libreoffice?

Thanks

andrés chandía’s picture

I would also want to change from jodconverter to pyodconverter
but I cannot succeed yet:
j-command:
{localhost:8100}{mv} "[in_file]" "[in_file].doc"; {java} -jar {{/opt/jodconverter/lib/jodconverter-cli.jar}} -o pdf "[in_file].doc"; {mv} "[in_file].doc" "[in_file]"; {mv} "[in_file].pdf" "[out_file]"

p-command:
{localhost:2002}{mv} "[in_file]" "[in_file].doc"; {python} {{/opt/pyodconverter/DocumentConverter.py}} "[in_file].doc"; {mv} "[in_file].doc" "[in_file]"; {mv} "[in_file].pdf" "[out_file]"

By command line I did it this way and it worked (yes, I had to change the libreoffice port to 2002 otherwise next command don't work):
python DocumentConverter.py file.doc file.pdf

So my question is what would be the right syntax where it says p-commad, I mean at the "Mime Converters" settings?

Thanks again for your help.

andrés chandía’s picture

just in case that you want to know why I'm trying to change the jodconverter to pyodconverter, here is the answer:

PDF document	application/pdf	-	Failed
JPEG image	image/jpeg	-	Failed
Flash SWF video	application/x-shockwave-flash	-	Failed
OpenDocument Text	application/vnd.oasis.opendocument.text	-	Failed
andrés chandía’s picture

weird thing is that by command line jodconverter works with libreoffice:

java -jar /opt/jodconverter/lib/jodconverter-cli.jar file.doc file.pdf

11/12/2013 11:39:12 com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection connect
INFO: connected
11/12/2013 11:39:21 com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection disposing
INFO: disconnected

but command with -o options says this:
java -jar /opt/jodconverter/lib/jodconverter-cli.jar -o pdf file.doc

Exception in thread "main" org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -o
	at org.apache.commons.cli.Parser.processOption(Parser.java:363)
	at org.apache.commons.cli.Parser.parse(Parser.java:199)
	at org.apache.commons.cli.Parser.parse(Parser.java:85)
	at com.artofsolving.jodconverter.cli.ConvertDocument.main(ConvertDocument.java:77)
jvieille’s picture

What is the rational for changing jodconverter to pyodconverter?
is the later dedicated to Libreoffice?
Thank you for grasping this issue

andrés chandía’s picture

At the FF front page it says:

Setting up your system for file conversions with File Framework by Ben Lavender

, and in that page it says:

you need a command line tool to interface with OpenOffice. JOD Converter handles that, and that's what we use. There's also a python version if that floats your boat.

So I decided to give it a try due to the fact that when I changed from openoffice to libreoffice conversions stoped to work properly

andrés chandía’s picture

I have restored the values to default in ..admin/settings/file/convert/converter and all worked well with jodconverter, I've prevously cheked this:

java -jar /opt/jodconverter/lib/jodconverter-cli.jar
usage: convert [options] input-file output-file; or
               [options] -f output-format input-file [input-file...]
 -f,--output-format <arg>   output format (e.g. pdf)
 -p,--port <arg>            OpenOffice.org port
 -v,--verbose               verbose
 -x,--xml-registry <arg>    XML document format registry

that means that the recomendation that appears at the begining of this thread is deprecated:

- change the -f parameter in the converters list to -o

so, don't do it....

jvieille’s picture

Issue summary: View changes

I confirm that Libreoffice works with FF without any change.
Just take care of the proper path installation for Jodconverter.
However, it needs some attention to properly run Libreoffice Headless.

Because no doc is available for this module and external pages get lost with time, here is the short indications for installing the libreoffice stuff ((Ubuntu 12.04 LTS):

Install fileinfo if your system has not yet it already (Note : I did not need that, it is in PHP 5.3)

apt-get install python-software-properties
add-apt-repository ppa:guilhem-fr/swftools
apt-get update
apt-get install swftools
apt-get install unrtf poppler-utils catdoc
add-apt-repository ppa:libreoffice/libreoffice-4-2
apt-get update
apt-get install libreoffice
apt-get install libreoffice-common
mkdir /jodconverter
cd /jodconverter
wget http://sourceforge.net/projects/jodconverter/files/JODConverter/2.2.2/jo...
unzip jodconverter-2.2.2.zip
add-apt-repository ppa:jon-severinsson/ffmpeg && sudo apt-get update -qq
apt-get install ffmpeg
apt-get install catdoc
apt-get install unrtf
apt-get install pdftotext
apt-get insta pstotext
apt-get install poppler-utils
apt-get install tesseract-ocr
apt-get install convert
apt-get install imagemagick

ghostscript was already ther or installed in the process

This is the script called "libreoffice-server-headless-lsb-initscript" that works for me

#!/bin/sh
### BEGIN INIT INFO
# Provides:          libreoffice-server-headless-lsb-initscript 
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Initscript to start LibreOffice as server
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="LibreOffice server"
NAME=libreoffice-server-headless-lsb-initscript
DAEMON=/usr/bin/libreoffice
SCRIPTNAME=/etc/init.d/$NAME
export HOME=/home/tmp/

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 3

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
   # Return
   #   0 if daemon has been started
   #   1 if daemon was already running
   #   2 if daemon could not be started
   #PID=`pgrep -f soffice.bin`
   PID_W_NL=`pgrep -fc soffice.bin`
   PID=`echo -n $PID_W_NL`
   if [ "$PID" != "0" ]; then
      return 1
   else
      sudo -u www-data env HOME=$HOME /usr/bin/libreoffice --headless --accept="socket,port=8100;urp;" --nofirststartwizard &
		if [ "$?" -eq "0" ]; then
	  		return 0
	   else
   		return 2	
	   fi
	fi

}

#
# Function that stops the daemon/service
#
do_stop()
{
	# Return
	#   0 if daemon has been stopped
	#   1 if daemon was already stopped
	#   2 if daemon could not be stopped
	#   other if a failure occurred
	PID_W_NL=`pgrep -fc soffice.bin`
	PID=`echo -n $PID_W_NL`
	if [ "$PID" = "0" ]; then
		return 1
	else
		pgrep -f soffice.bin | xargs kill -9
  	   if [ "$?" -eq "0" ]; then
         return 0
  	   else
         return 2
      fi
	fi
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
	return 0
}

#
# Function that checks status of the daemon/service
#
do_status()
{
	# Return
	#   0 One or more processes matched the criteria.
	#   1 No processes matched.
	#   2 Syntax error in the command line.
	#   3 Fatal error: out of memory etc.
	PID_W_NL=`pgrep -fc soffice.bin`
   PID=`echo -n $PID_W_NL`
	if [ "$PID" = "0" ]; then
      echo "Not running"
	else
      echo "Running"
	fi
	return 0
}

case "$1" in
	start)
		log_daemon_msg "Starting $DESC" "$NAME"
		do_start
		case "$?" in
			0|1) log_end_msg 0 ;;
			2) log_end_msg 1 ;;
		esac
	;;

	stop)
		log_daemon_msg "Stopping $DESC" "$NAME"
		do_stop
		case "$?" in
			0|1) log_end_msg 0 ;;
			2) log_end_msg 1 ;;
		esac
	;;

	restart|force-reload)
		log_daemon_msg "Restarting $DESC" "$NAME"
		do_stop
		case "$?" in
			0|1)
				do_start
				case "$?" in
					0) log_end_msg 0 ;;
					1) log_end_msg 1 ;; # Old process is still running
					*) log_end_msg 1 ;; # Failed to start
				esac
			;;
			*)
				# Failed to stop
				log_end_msg 1
			;;
		esac
	;;

	status)
		do_status
		exit $?
	;;

	*)
		echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
		exit 3
	;;
esac

You'll need to enable this script as a service - see ubuntu documentation.
Then type
service libreoffice-server-headless-lsb-initscript start
Look at your server if libroffice is runnin.
Check at the next reboot if it still runs

gobinathm’s picture

Status: Active » Closed (outdated)

Closing the issue. It was inactive for a long time & it's related to a Drupal Version which is not supported anymore