PDF and JPG conversion

PDF files containing scanned JPG files can be converted:

from the folder where the .pdf file is type:

pdfimages -j filename.pdf filename

to extract all jpg files in the same folder.

If you use

pdfimages filename.pdf filename

The output will be ppm files, but that takes a conversion

Put all .jpg files into pdf files:

ls -1 ./*jpg | xargs -L1 -I {} img2pdf {} -o {}.pdf

Combine those .pdf files into one .pdf file:

pdftk *.pdf cat output file.pdf

you may need to install some of these programs first, but the ternminal will tell you so.