Mar 07
Convert images to PDF document, on Linux, on CLI
Often you need to simply convert a JPG or PNG image into a one-page PDF document. The easiest way is to do this from command-line on Linux, a simple one-liner command:
convert some.png some.png.pdf
But on more recent Linux installations, this makes problems, as some security settings prevent gs and convert to work properly.
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/413.
And getting this fixed requires hacking around in security rules and more headaches.
A simple drop-in alternative command is to use LibreOffice / OpenOffice in headless mode: works just as well:
soffice --headless --convert-to pdf:writer_pdf_Export input-image.png
Related
Merging multiple pdf files and jpg files into one PDF
Combining two or more PDFs into one, on Linux