Skip to content

/errors/imagemagick/not-allowed-by-security-policy-pdf

ImageMagick: not allowed by the security policy `PDF'

The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
tool
ImageMagick
exit code
1
versions
ImageMagick 6, ImageMagick 7
os
linux

ImageMagick fails with attempt to perform an operation not allowed by the security policy PDF'when itspolicy.xml` forbids the PDF coder. Many Linux distributions ship that rule because ImageMagick hands PDF, PostScript and EPS files to Ghostscript, which has had serious vulnerabilities. Allow the coder only if the files you process are trusted.

Find the policy file

bash
magick -list policy | head -20        # ImageMagick 7
convert -list policy | head -20       # ImageMagick 6

The first lines show the path of the active policy.xml (for example /etc/ImageMagick-6/policy.xml on Debian and Ubuntu).

The rule that blocks PDF

policy.xml
<policy domain="coder" rights="none" pattern="PDF" />

Fix: allow PDF for trusted input

policy.xml
<policy domain="coder" rights="read|write" pattern="PDF" />

No restart is needed; the next ImageMagick command reads the file again.

Alternatives that avoid relaxing the policy

bash
pdftoppm -png -r 150 input.pdf page            # poppler-utils
gs -sDEVICE=png16m -r150 -o page-%d.png input.pdf

Sources