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 the 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.

Example:

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