pdfcpu split horizontal_input.pdf ./out
for i in {1..N}; do pdfcpu crop -- 'pos:tl,dim:50% 100%' out/splitted_${i}.pdf out/splitted_${i}_a.pdf;done
for i in {1..N}; do pdfcpu crop -- 'pos:tr,dim:50% 100%' out/splitted_${i}.pdf out/splitted_${i}_b.pdf;done
pdfcpu merge ./out/merged.pdf ./out/splitted*.pdf
docker run --rm -v pwd
:/app -w /app minidocks/ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -dColorImageResolution=150 -sOutputFile=output.pdf input.pdf