Convert ppt to pdf in php linux

There is an opensource available for converting PowerPoint document (PPT) to Portable Document Format (PDF). And you can find it at

In this post i will illustrate you how to convert ppt to pdf format and many other formats.

First of all its a java based convertor and converts the following documents.

From (any of) To (any of)
Text Formats
OpenDocument Text (*.odt) 1.0 Text (*.sxw)
Rich Text Format (*.rtf)
Microsoft Word (*.doc)
WordPerfect (*.wpd)
Plain Text (*.txt)
HTML1 (*.html)
Portable Document Format (*.pdf)
OpenDocument Text (*.odt) 1.0 Text (*.sxw)
Rich Text Format (*.rtf)
Microsoft Word (*.doc)
Plain Text (*.txt)
HTML2 (*.html)
MediaWiki wikitext (*.wiki)
Spreadsheet Formats
OpenDocument Spreadsheet (*.ods) 1.0 Spreadsheet (*.sxc)
Microsoft Excel (*.xls)
Comma-Separated Values (*.csv)
Tab-Separated Values (*.tsv)
Portable Document Format (*.pdf)
OpenDocument Spreadsheet (*.ods) 1.0 Spreadsheet (*.sxc)
Microsoft Excel (*.xls)
Comma-Separated Values (*.csv)
Tab-Separated Values (*.tsv)
HTML2 (*.html)
Presentation Formats
OpenDocument Presentation (*.odp) 1.0 Presentation (*.sxi)
Microsoft PowerPoint (*.ppt)
Portable Document Format (*.pdf)
Macromedia Flash (*.swf)
OpenDocument Presentation (*.odp) 1.0 Presentation (*.sxi)
Microsoft PowerPoint (*.ppt)
HTML2 (*.html)
Drawing Formats
OpenDocument Drawing (*.odg) Scalable Vector Graphics (*.svg)
Macromedia Flash (*.swf)

JODConverter can be used in many different ways

  • As a Java library, embedded in your own Java application
  • As a command line tool, possibly invoked from your own scripts
  • As a simple web application: upload your input document, select the desired format and download the converted version
  • As a web service, invoked from your own application written in your favourite language (.NET, PHP, Python, Ruby, …)

JODConverter is open source software released under the terms of the LGPL and can be downloaded from

Here I will be illustrating how to make it work on a windows platform as I have still done it on windows platform. If anyone needs to install it on linux platform they can got to for more details.

Firstly you will need following softwares that need to be installed on your system.

  1. A Java runtime environment version 1.4 or higher
  2. v2.0.3 or higher; the latest stable version is usually recommended. (StarOffice 8, NeoOffice being based on should also work.)
  3. Apache-Tomcat server incase you want to make it work as web application.

Install java runtime environment, open office for windows and apache-tomcat (if you want to run it as web application).

Now if you want to use directly from command line, open command line (Start->Run->cmd) and make open office to listen to the 8100 post through command “soffice –accept=”socket,host=localhost,port=8100;urp;StarOffice.ServiceManager””

Then to convert the documents with command you need to download the following file, unpack and execute the jodconverter-cli-2.2.0.jar JAR with java. if this link doesn’t work please try other mirror.

To convert a single file, go to the directory or the folder you have unpacked the above file, specify input and output files as parameters

java -jar lib/jodconverter-cli-2.2.0.jar document.doc document.pdf

Okay, to make it work as web application please you need to install tomcat-apache. Next download the following file and extract it. here also if this link doesn’t work, please try other mirror.

Go to the webapps directory/folder of your apache-tomcat installation. In my case its C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps and copy the files

jodconverter-webapp-2.2.1.war and src directory/folder there, rename jodconverter-webapp-2.2.1.war to converter

now start the apache-tomcat server and run the following link http://localhost:8080/converter/.

also to make listening the port 8100 for openoffice you can do the following.

Creating a Windows Service lets you have an instance always running as a service and listening for connections. That’s what you usually want to do on a server machine.

Here’s how to create a Windows Service using the SRVANY utility that you can download for free as part of the Resource Kit. (This was done on an XP SP2, YMMV.)

1. is already installed and started at least once under the current user

2.  Download and install the Windows Server 2003 Resource Kit Tools

3.  Read How To Create a User-Defined Service

4.  Create a service named OpenOfficeUnoServer following the instructions above;

Command Prompt>”C:\Program Files\Windows Resource Kits\Tools\Instsrv.exe” OpenOfficeUnoServer “C:\Program Files\Windows Resource Kits\Tools\Srvany.exe”

This will create some registry keys for a new service called “OpenOfficeUnoServer“.

5.  Modify the registry keys
Open the registry editor (use the start/execute/regedit.exe or regedit32.exe) and locate the following registry key:


Create a subkey named “Parameters” and create two string values (update the paths to your local settings):

  • Application, with a value of  C:\Program Files\ 2.2\program\soffice.exe (the path of ‘soffice.exe’)
  • AppParameters, with a value of  -headless -accept=socket,port=8100;urp;StarOffice.ServiceManager

6.  From Control Panel / Administrative Tools / Services open the Properties for the new service and change the Log On account to be Local Service which is a more secure option than SYSTEM

7.  If we stop here the service will start but not actually work. That’s because the service runs as a special account and will try to show the license agreement dialog as if it was a new user instead of starting the application. To avoid this, you need to edit share\registry\data\org\openoffice\Setup.xcu (it’s an XML file) inside the installation directory and replace this bit.

<prop oor:name=”ooSetupInstCompleted”>
<prop oor:name=”ooSetupShowIntro”>

with this other one (ideally you should replace the date with the one when you accepted the license)

<prop oor:name=”ooSetupInstCompleted” oor:type=”xs:boolean”>



<prop oor:name=”LicenseAcceptDate” oor:type=”xs:string”>



<prop oor:name=”FirstStartWizardCompleted” oor:type=”xs:boolean”>



8.  Start your new service (e.g. from Control Panel / Administrative Tools / Services). You may need to unblock the new service at the firewall level
9.  From a command prompt do
        Command Prompt> netstat -anp tcp

this should show a listening on port 8100. Chances are that the service will only listen on the interface; this means you can only connect from the same machine and it’s good from a security point of view. However, if you want to be able to connect from other machines as well you need to change the accept string to "socket,host=,port=8100;...." in the AppParameters registry value

2. From Command Prompt

From the command prompt C:\Program Files\ 2.2\program>

type soffice -accept=”socket,host=<HOST NAME>,port=8100;urp;StarOffice.ServiceManager” and press Enter to start the OpenOffice Service Manager.

eg: C:\Program Files\ 2.2\program>soffice -accept=”socket,host=<HOST NAME>,port=8100;urp;StarOffice.ServiceManager”

Note: i) The port number can be given according to your preference.

ii) HOST NAME can be either localhost or the ip address

8 thoughts on “Convert ppt to pdf in php linux

  1. So, this Java isn’t doing much. Simply piping stuff into and out of OpenOffice. The “conversion” won’t be any better than opening the document in OpenOffice and doing a “Save-as”.

  2. Hi,
    That’s a wonderful idea you have provided there. I was looking for a similar script for my application. I just need some help from you.
    In case, the service that we are using through command line isn’t installed or is not started, then the service shows an error in command line. But if we use it though a script, like PHP, then it will not show an error.
    I just need to know through the script that the service is working or not, so that the users are notified and an error message will be displayed.
    Thanks in advance,

  3. It sounds like quite a nice tool that can help users convert ppt to pdf, thanks for sharing such a good stuff! I will give it a try! Before this, I was always using another cost-effective PowerPoint to video software to convert my presentation to needed video format that can be played on any players and put it on website,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s