Using MacOS to convert any PDF to a PDF/A

One needs the command line tools pdf2ps and gs.

If one does not have them, then one can get them using the MacOS package manager HomeBrew: https://brew.sh. After setting up HomeBrew, install the ghostscript commands with this command: brew install ghostscript

If the existing PDF is called original.pdf and the final pdf/A compatible file will be called original_pdfa.pdf, then the necessary command steps are:

  1. pdf2ps original.pdf original.ps
  2. gs -dPDFA=2 -dBATCH -dNOPAUSE -dNOOUTERSAVE -dUseCIEColor -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sPDFACompatibilityPolicy=1 -sOutputFile=original_pdfa.pdf original.ps
  3. rm -f original.ps

These individual commands can be packaged as a simple BASH function to be put inside one's .bashrc file:

pdf2pdfa () {
  pdf2ps $1 ${1%.*}.ps
  gs -dPDFA=2 -dBATCH -dNOPAUSE -dNOOUTERSAVE -dUseCIEColor -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sPDFACompatibilityPolicy=1 -sOutputFile=${1%.*}_pdfa.pdf ${1%.*}.ps
  rm -f ${1%.*}.ps
}

Then the command: pdf2pdfa original.pdf will generate the PDF/A compatible file original_pdfa.pdf.

As the file is processed, the following warning may be issued: Use of -dUseCIEColor detected! Since the release of version 9.11 of Ghostscript we recommend you do not set -dUseCIEColor with the pdfwrite/ps2write device family. However, there does not seem to be a way around this.

H/T Michelle Driscoll and https://superuser.com/a/1269352