Friday, November 27, 2009

How to convert a JPG file to PDF

You need to have installed "ImageMagick" or "GraphicsMagick"
In Ubuntu or Debian you can install it with the command:
sudo apt install imagemagick

or
sudo apt install graphicsmagick

Then you go to your work directory.
cd my/work/directory/path
And write the command
convert myfile.jpg myfile.pdf

Or with GraphicsMagick
gm convert file.jpg file.pdf

To convert multiple images:
gm convert file1.png file2.png file3.jpg file.pdf

For more, just run:
man gm

With ImageMagick you can also convert multiple JPG files into one multi-image PDF
convert *.jpg -adjoin myfiles.pdf

To merge multiple PDFs into one file:

$ pdftk file1.pdf file2.pdf file3.pdf cat output file123.pdf

CONVERTING  WITH  IMG2PDF

sudo apt install img2pdf

img2pdf --pagesize Letter input.jpg -o output.pdf

man img2pdf 



=====///////