Hello!
I have worked with manipulating and rendering the PDF format before, layers, viewports, pages, text & OCR.
Many libraries in most common languages can do this task, it will depend on what OS your CLI is for. Perhaps a wrapper around imagemagick with ghostscript can work too.
Please message me if you are interested, I would be interested in seeing some sample PDFs that you need processed.
Thanks!