66.5 PDF Conversions


ImageMagick provides considerable functionality for image conversion, including converting from pdf to png.

To convert from pdf to png a -denisty of 300 and -resize 50% seems to work well:

convert -density 300 myimg.pdf -resize 50% myimg.png

This may fail due to an ImageMagick security policy when the GhostScript interpreter is being used as in the handling of pdf files.

$ convert my.png my.pdf
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/426.

You may like to research the risk and then override the policy by editting /etc/ImageMagick-6/policy.xml to comment out the appropriate policy line:

sudo emacs /etc/ImageMagick-6/policy.xml
  <!-- policy domain="coder" rights="none" pattern="PDF" / -->

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0