Working with pdfs from the command line

Merge pdfs from Bash

sudo apt install pdftk
pdftk file1.pdf file2.pdf cat output mergedfile.pdf

from here

Merge using ghostscript:

gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=merged.pdf simple1.pdf simple2.pdf simple3.pdf

from here

Shrink a PDF from the command line

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Convert to PDF-A

gs -dPDFA -dBATCH -dNOPAUSE -sColorConversionStrategy=UseDeviceIndependentColor -sDEVICE=pdfwrite -dPDFACompatibilityPolicy=2 -sOutputFile="outputfile.pdf" "inputfile.pdf"