I am getting the following exception when using print_pdf and TCPDF 5.9.202 and 5.9.120 (I needed to hack print_pdf.pages.inc with some error reporting to see it):
ImagickException Object
(
[message:protected] => unable to open file `/home/.../www/.../drupal-7.x/file:/home/.../www/.../drupal-7.x/sites/default/files/logo2013-2-64_0.png' @ png.c/ReadPNGImage/2921
[string:private] =>
[code:protected] => 1
[file:protected] => /home/.../www/.../drupal-7.x/sites/all/libraries/tcpdf-5.9.120/tcpdf.php
[line:protected] => 8109
[trace:private] => Array
(
[0] => Array
(
[file] => /home/.../www/.../drupal-7.x/sites/all/libraries/tcpdf-5.9.120/tcpdf.php
[line] => 8109
[function] => readimage
[class] => Imagick
[type] => ->
[args] => Array
(
[0] => file:///home/.../www/.../drupal-7.x/sites/default/files/logo2013-2-64_0.png
)
Reviewing the code, I see that _print_pdf_file_access_images() converts all private images to "file://" streamwrapper. While TCPDF itself seems to handle those OK, TCPDF calls Imagick and passes file names directly (i.e. $img = new Imagick(); $img->readImage($file);). Imagick is not handling streamwrapper file names and throws the above exception.
Comments
Comment #1
iva2k commentedIn case anyone is interested, here's a patch that includes:
Comment #2
yang_yi_cn commentedI'm definitely interested, having the same problem for the 6.x version as well.
I believe the 6.x version doesn't use streamwrapper. However I do have a question is that why the TCPDF try to use ImageMagick at all? Although it is available, my image API toolkit is set to use GD.
Comment #3
yang_yi_cn commentedThis issue is more related to the image extension (GD v.s. ImageMagick) as this issue happens to public file system as well.
Also, attached a patch for 6.x
Comment #3.0
yang_yi_cn commentedcleanup
Comment #4
jcnventuraClosing all issues related to the Drupal 6 version of the print module.