Extract images from multiple PDFs. The Poppler toolset provides pdfimages.

mkdir images
for f in *.pdf ;  do 
     pdfimages -p -all ${f} images/${f%.*} ; 

Rename per page.

i=1; for f in `ls -1 *.jpg | sort` ; do  mv $f p-$i.jpg; i=$[$i + 1]; done

Create PDF from images. Using https://imagemagick.org/ or the fork http://www.graphicsmagick.org/

convert `ls -1 p-*.jpg | sort` foo.pdf

Cairo is another package that provides PDF manipluation.