Print PDF from any Linux program
On Linux, the
CUPS PDF
program saves printed PDFs to the ~/PDF directory from any program.
apt install printer-driver-cups-pdf
# or
dnf install cups-pdf
# then
systemctl restart cupsVerify a PDF printer is visible:
lpstat -p -dThe PDF output directory can be configured by editing the “Out” directory in /etc/cups/cups-pdf.conf
Higher quality PDF might be obtained by using the PDF print options in the specific program, if available.
LibreOffice PDF Conversion
Alternatively, LibreOffice can print compatible documents to PDF directly from the command line in headless mode like:
soffice --headless --convert-to pdf file.docxLibreoffice can be installed like
apt install libreoffice-commonRelated: convert image stack to PDF