#!/bin/bash PATH=/usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin HOME=/tmp echo -e "Content-Type: application/pdf\n" mkdir -p ${HOME}/lo_pdfs /usr/bin/soffice \ --headless \ "-env:UserInstallation=file:///tmp/LibreOffice_Conversion_${USER}" \ --convert-to pdf:writer_pdf_Export \ --outdir ${HOME}/lo_pdfs \ ${PATH_TRANSLATED} PDF=$(basename ${PATH_TRANSLATED}) PDF=${PDF%.*}.pdf cat ${HOME}/lo_pdfs/${PDF} rm ${HOME}/lo_pdfs/${PDF}