Question: How can I merge several `.png` files into one PDF file in Unix?

Answer: 
If I want to merge some scans to one PDF file, I do this:

```
pdfjoin --a4paper --fitpaper false --rotateoversize false scan01.png scan02.png

```

This gives you a PDF document with DIN-A4 page size, where every `png` file is centered on it's own page. Images that are too big for one DIN-A4 page are resized proportionally to fit on one page. Smaller images are not resized (not made bigger).

You have to name all `png` files on the command line, but you can also use wildcards to eg merge all png files in the current directory:

```
pdfjoin --a4paper --fitpaper false --rotateoversize false *.png

```

The `pdfjoin` command is part of PDFjam as mentioned in the answer by Jeremiah Willcock. So you will most likely have to install a package named `pdfjam` or `texlive-extra-utils` with your distros package manager. PDFjam is able to use `png` files as input since Version 2.07, released in 2010-11-13.
I stole this, but this is the solution I used from Jeremiah Willcock and another answer website. Not digging through history at the moment. I lied, I did. (Tully @<https://askubuntu.com/a/626301>)  

I needed a file small enough to email.

To combine images into a PDF
(from in working directory use command line:

```
user@box:/home/user/scans/:$ 
convert 1.png 2.png convertoutput.pdf

```

To shrink using ghostscript after combining 
(I used on kde default system almost):

```
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default \
   -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages -dCompressFonts=true \
   -r150 -sOutputFile=output.pdf convertoutput.pdf

```

My file had 14 images (19MB after convert, gs made it 1.6MB, quality was still great). The output file is called `output.pdf`.