FreeBSD - Converting images to PDF
Hi !
I recently had a request to:
- Produce PDF documents from various images (5) in JPEG format;
- Make a single PDF file from the 5 small PDF files.
My server at home is FreeBSD (yes, I use and abuse of “JAILS”) so let’s look at the software needed for the maneuver.
- ImageMagick (for ‘convert’)
- poppler-utils (for ‘pdfunite’)
I leave the choice of installation to you but as both exist as packages, let’s go for the easy way.
# pkg install ImageMagick
# pkg install poppler-utils-23.02.0
Once this first part is over, let’s get to the heart of the matter.
- Convert images to PDF files
$ for a in *.jpeg; do convert $a $a.pdf; done
- Creation of the final PDF file from the 5 files created above.
$ pdfunite 1.jpg.pdf 2.jpg.pdf 3.jpg.pdf 4.jpg.pdf 5.jpg.pdf demo.pdf
Job done.
Regards