How to Fix ImageMagick\'s \'not authorized\' Error When Converting PDFs?

Barbara Streisand
Release: 2024-11-25 06:56:15
Original
774 people have browsed it

How to Fix ImageMagick's

ImageMagick Conversion Issue: Lack of Authorization

In certain instances, attempts to convert a PDF to an image using ImageMagick via the subprocess package may encounter an error that reads:

convert-im6.q16: not authorized `temp2.pdf' @ error/constitute.c/ReadImage/412.
Copy after login

This error indicates that ImageMagick lacks the necessary authorization to access the PDF file. To resolve this issue, follow the steps outlined below:

  1. Modify the ImageMagick Policy File:

Open the ImageMagick policy file located at /etc/ImageMagick-6/policy.xml.

  1. Uncomment and Modify the Policy Line:

Locate and uncomment the following line:

<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
Copy after login

Change the value of "rights" from "none" to "read|write":

<policy domain="module" rights="read|write" pattern="{PS,PDF,XPS}" />
Copy after login

Note: On some systems, the policy line may use "domain="coder"" instead of "domain="module"."

  1. Save and Restart ImageMagick:

Save the changes to the policy file and restart ImageMagick. The specific command to restart ImageMagick varies depending on the platform you are using.

By executing these steps, you will grant ImageMagick the necessary authorization to access and convert the PDF file.

The above is the detailed content of How to Fix ImageMagick\'s \'not authorized\' Error When Converting PDFs?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template