After successfully Installation of OpenOffice.org, just move to “D:\Program Files\OpenOffice.org 3\program” as my Operating system is installed in “D:\” drive as in this fig.1
Here you can find all files and make sure “soffice.exe” is in that place or not. See it in fig.2
Now Open the command prompt using run command like in this and copy the path from previous window. See in fig.3
Copy D:\Program Files\OpenOffice.org 3\program and place it in command prompt and hit enter
So all you have to do is start OOo(OpenOffice.org) with something like
Most likely you should add the path of your OOo installation: “c:\program files\OpenOffice.org 3\program\soffice.exe” -accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager
here you have to place host as 127.0.0.1 and StarOffice.ServiceManager as –nofirststartwizard
So, Copy soffice -headless -accept=”socket,host=127.0.0.1,port=8100;urp;” -nofirststartwizard and place it in command prompt and hit enter.
By this you can start this service to the OpenOffice.org; you can see it in fig.4
If You restart or shutdown the System in which OpenOffcie.org is installed , Then you have to follow these steps for sure as it is mandatory for start the service for communication soffice.exe to JODConverter.
Creating an OpenOffice.org Service on Unix-like systems
Creating a SysV-style init script for starting OpenOffice.org is not difficult but the details depend on your particular OS flavour/distribution.
The tricky part is that OpenOffice.org requires an X server to work. On a headless server, you can use Xvfb as a dummydisplay for OpenOffice.org.
However since OpenOffice.org 2.3 an X server server is no longer needed; it is now possible to start OpenOffice.org in “true” headless mode simply by making sure the DISPLAY environment variable is not defined:
$ unset DISPLAY
$ soffice -headless -accept=”socket,host=127.0.0.1,port=8100;urp;” -nofirststartwizard
Usage as a Java Library
Using JODConverter in your own Java application is very straightforward. The following example shows the skeleton code required to perform a one off conversion from a Word document to PDF:
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);
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
// close the connection
To convert from/to other formats, simply change the file names and the formats will be determined based on file extensions; e.g. to convert an Excel file to OpenDocument Spreadsheet:
File inputFile = new File("spreadsheet.xls");
File outputFile = new File("spreadsheet.pdf");
Simple, isn’t it?
If you’re integrating JODConverter in a web application for example you may want to initialise a single OpenOfficeConnection instance when the app is started and disconnect it when the app is stopped.