Convert PDF to PDF with only images to prevent it from editing

This article with describe how to convert PDF file to PDF consisting only from images. This operation permits future editing PDF using such converters as iLovePDF.

To do this you need to install imagemagick from there official site, or install via package managers. For Mac OS you can use brew for it:

brew install imagemagick

Next you can execute next command, that will convert PDF to PNG images

convert -density 1200 name_of_pdf.pdf -resample 300 -scale 4096x4096 page.png

Next you need convert PNG images from first command to PDF, using:

convert *.png -scale 4096x4096 output.pdf

This two commands can take a time to execute, depending from the size of your PDF file.

Also you can create alias in bash, adding these command to yours ~/.zshrc (or another shell)

pdftopng(){
   mkdir -p topng
   convert -density 1200 $1 -resample 300 -scale 4096x4096 topng/page.png
   convert topng/*.png -scale 4096x4096 comp.$1
}

Don't forget to do source ~/.zshrc.