-
-
Save doxavore/1197963 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
require 'jodconverter-cli-2.2.1.jar' | |
def convert(file_in,file_out) | |
inputFile = java.io.File.new(file_in) | |
outputFile = java.io.File.new(file_out) | |
# connect to an OpenOffice.org instance running on port 8100 | |
connection = com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection.new(8100) | |
connection.connect() | |
# convert | |
converter = com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter.new(connection) | |
converter.convert(inputFile, outputFile) | |
# close the connection | |
connection.disconnect(); | |
end | |
convert 'test.txt', 'test.pdf' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment