Can't render user-uploaded .png and .jpeg into pdf
Hello!
Running the container under Docker, PDFs were working fine, but .png and .jpeg were not. I found the following error in /usr/share/docassemble/log/docassemble.log:
docassemble: ip=100.14.196.120 i=docassemble.playground1:test.yml uid=bkNXSKtxLKsuSpwxQXdOTaAH97Cl6rhZ [email protected] 2021-08-01 13:28:59 failed to convert image to PDF: convert /usr/share/docassemble/files/000/000/000/008/file.png /tmp/datemp4im7aysu.pdf
Attempting to run the convert command by hand I got:
convert-im6.q16: attempt to perform an operation not allowed by the security policy 'PDF' @error/constitute.c/IsCoderAuthorized/421.
A web search found this, and the fix worked: edit /etc/ImageMagick-6/policy.xml, and at the bottom add the following line just before </policymap>:
<policy domain="coder" rights="read | write" pattern="PDF" />
Nik
If you do a system upgrade, you'll get a Docker image that uses the latest version of jhpyle/docassemble-os, which has a line in the Dockerfile that makes that change to policy.xml. I made this fix with version 1.1.95 last November, but if you installed your system between June and November of last year, your ImageMagick will likely still have this problem.
I'm a little mystified because I just installed this testbed on July 27 using the docker instructions here. But today I just cleaned everything and installed from scratch and now the updated config is there. 🤔 In any case, thanks for the reply!
That is unexpected, then. Maybe if ImageMagick gets upgraded, the upgrade can undo the effect of patching https://github.com/jhpyle/docassemble-os/blob/master/Dockerfile#L131. I'll need to deal with that in the Dockerfiles. Thanks!
I think I made fixes to address this issue, so I am closing it for now.