ImageMagick Access Denied: Converting PDFs to Images
In this issue, a program utilizes the subprocess package to convert a PDF document to an image using ImageMagick. The user encountered an error indicating "not authorized `temp2.pdf'".
Diagnosis and Solution:
The error suggests that ImageMagick lacks the necessary authorization to access the PDF file. To resolve this issue, modify the ImageMagick policy.xml file.
Detailed Steps:
<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
<policy domain="module" rights="read|write" pattern="{PS,PDF,XPS}" />
Additional Information:
This policy update was recently implemented due to a security flaw in the Ghostscript delegate. The flaw has been patched in the latest version of Ghostscript (9.25).
Note:
On certain systems, the policy line may specify domain="coder" instead of domain="module".
The above is the detailed content of Why Does ImageMagick Return \'Access Denied\' When Converting PDFs and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!