I am using the following code to convert .doc to .pdf using JOD.
File inputFile = new File("document.doc");
File outputFile = new File("document.pdf");
// connect to an OpenOffice.org instance running on port 8100
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
connection.connect();
// convert
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);
// close the connection
connection.disconnect();
But I have to run
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
separately to start LibreOffice in headless mode.
Is there a way to start LibreOffice programmatically? Or, can't we just give the path to LibreOffice folder to JOD to do the conversion?
You don't need JOD at all to convert a doc file to a PDF. This can be directly done with LibreOffice:
libreoffice --headless --convert-to pdf document.doc