Hi. Sorry for my english.
My images delivered by image_cache module.
The following Code trows an PDF-Error. On Line 52.

modules/print/print_pdf/lib_handlers/print_pdf_tcpdf/print_pdf_tcpdf.pages.inc

Example:

$html='<img src="http://www.example.com/sites/default/files/123456.jpeg?itok=LdD-FdVG">';

Line 52: $pattern = "!(<img\s[^>]*?src\s*?=\s*?['\"]?{$base_url}[^>]*?)(?:%3F|\?)[\w=&]+([^>]*?>)!is";
Line 53: $html = preg_replace($pattern, '$1$2', $html);

Result: <img src="http://www.example.com/sites/default/files/123456.jpeg-FdVG">

At the End: 123456.jpeg-FdVG
Can you change the RegEx to del the "-" also.

Thx

Comments

dscutaru’s picture

$pattern = "!(<img\s[^>]*?src\s*?=\s*?['\"]?{$base_url}[^>]*?)(?:%3F|\?)[\w=\-&]+([^>]*?>)!is";

works for me([\w=&] is replaced with [\w=\-&]), also it works(for me) after commenting out line 53

jcnventura’s picture

Status: Active » Fixed

Let's try an even better pattern [^\s'\"] instead.

http://drupalcode.org/project/print.git/commit/9b403a5

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

daulet2030’s picture

Can you also add for mpdf library inside print_pdf_mpdf.pages.inc?