2024-10/cgi-bin/lo2pdf.sh

21 lines
439 B
Bash
Raw Permalink Normal View History

2024-10-17 06:49:16 +00:00
#!/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}