views:

111

answers:

1

Hello,

I'm using Ruby for displaying the contents of powerpoint files in a webpage. I've found solutions using the win32ole but I'm in the linux environment and it doesn't work. I think the application could trigger a openoffice command for conversion.

+1  A: 

You can use Rjb (http://rjb.rubyforge.org/) and JODConverter (http://www.artofsolving.com/opensource/jodconverter) to export your powerpoint to flash (or any other format - see : http://www.artofsolving.com/opensource/jodconverter/guide/supportedformats)

Here is a pice of code to do it :

require 'rubygems'
require 'rjb'

classpath = nil

Rjb::load( classpath, ['-Djava.awt.headless=true'] )

jFile = Rjb::import( 'java.io.File' )
jSocketOpenOfficeConnection = Rjb::import( 'com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection' )
jOpenOfficeDocumentConverter = Rjb::import( 'com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter' )

input = jFile.new( "your-doc.ppt" )
output = jFile.new( "your-doc.swf" )

# connect to an OpenOffice.org instance running on port 8100
connection = jSocketOpenOfficeConnection.new( 8100 )
connection.connect()

# convert
converter = jOpenOfficeDocumentConverter.new( connection )
converter.convert( input, output )

# close the connection
connection.disconnect()

You need to start an OOo.org server :

soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

And to add jodconverter-cli-X.X.X.jar to your CLASSPATH

greg