How to convert documents to PDF in PHP?

How to convert documents to PDF in PHP?

‘Unoconv’ is the tool to convert doc, docx, odt to PDF file in PHP.


‘Unoconv’ is a command line utility that can convert files from any ‘OpenOffice’ supported formats to a different ‘OpenOffice’ supporting format.


Installation Required:

  • OpenOffice and Unoconv

You can provide one or more files as arguments to convert each of them to the specified output format.


unoconv -f pdf  example.doc

bove command will convert the example.doc to example.pdf in the current working directory.

Some other commands are:

unoconv -f odt example.doc
unoconv -f doc example.odt
unoconv -f jpg example.odt
unoconv -f xsl example.csv