Art of Solving has also a very good API to perform the conversion in java. Is a little slow but it is simple enough. This is how I use it.
File inputFile = new File("C:\\oreyes\\hola.doc");
File outputFile = new File("C:\\oreyes\\hola.pdf");
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
try {
connection.connect();
} catch(Exception e) {}
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);
connection.disconnect();
You can create a jar with that and process it from the command line.