pdfimages -j -p file.pdf ./images/prefix
cd images
mogrify -level 80%,85% -sharpen 0x1 prefix*.jpg
convert -background white -page a4 prefix*.jpg new.pdf
If ImageMagick returns a not autorized error go to /etc/ImageMagick-VERSION/policy.xml and change the line:
<policy domain="coder" rights="none" pattern="PDF" />
To:
<policy domain="coder" rights="read|write" pattern="PDF" />