1. The above one line shell snippet in php script is used to convert the powerpoint file in to PDF file using libreoffice. The same command can be used for all the files which are able to open using libreoffice like doc, docx, odt, odp, etc., Shell command is enclosed in back tick symbol not single quotes. PHP by default execute command inside back tick as shell command alternatively you can use shell_exec
  2. Let’s we see each arguments and it’s description (this is an excerpt from official document) we passed to the shell command libreoffice
  3. --headless        Starts in “headless mode” which allows using the application without GUI. This special mode can be used when the application is controlled by external clients via the API.
  4. --invisible        Starts in invisible mode. Neither the start-up logo nor the initial program window will be visible. Application can be controlled, and documents and dialogs can be controlled and opened via the API. Using the parameter, the process can only be ended using the taskmanager (Windows) or the kill command (UNIX-like systems). It cannot be used in conjunction with –quickstart.
  5. --convert-to OutputFileExtension[:OutputFilterName] \ [--outdir output_dir] [--convert-images-to]        Batch convert files (implies –headless). If –outdir isn’t specified, then current working directory is used as output_dir. If –convert-images-to is given, its parameter is taken as the target filter format for *all* images written to the output format. If –convert-to is used more than once, the last value of OutputFileExtension [:OutputFilterName] is effective. If –outdir is used more than once, only its last value is effective. For example:
    --convert-to pdf *.odt
    --convert-to epub *.doc
    --convert-to pdf:writer_pdf_Export --outdir /home/user *.doc
    --convert-to "html:XHTML Writer File:UTF8" \
    --convert-images-to "jpg" *.doc
  6. Finally we pass shell command textual output to virtual device /dev/null using > symbol in linux based distros whatever it receives as input it will discard it. As a result there won’t be displaying of any message when you using this snippet inside your custom function or method.