Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If HTML code contains images with src attribute starting with two slashes (without protocol part), PDF version does not include this image.
Example HTML code:
<img id="chart-chart_field_chart_collection" class="chart" src="//chart.googleapis.com/chart?chd=t%3A2001%2C2002%2C2003%7C14423.00%2C13211.00%2C16732.00&cht=p3&chs=300x150&chf=" alt="Chart">
This image won't be visible in PDF - you will get errors instead:
Image not found
http://my.domain.com/chart.googleapis.com/chart?chd=t%3A2001%2C2002%2C20...
where my.domain.com is my domain name.
I've tried to fix it - the patch that makes it working is attached below.
Comment | File | Size | Author |
---|---|---|---|
#1 | print-replace_img_src_urls_with_absolute_urls-1542056-1.patch | 2.47 KB | lklimek |
Comments
Comment #1
lklimek CreditAttribution: lklimek commentedPatch is attached.
Tested only with "book" content type.
Comment #2
lklimek CreditAttribution: lklimek commentedComment #3
jcnventura CreditAttribution: jcnventura commentedI can't understand why you need to call the image replacement explicitly.. The PDF module already does this to all images, and the others shouldn't care... Have you tested with only the modifications you did to _print_rewrite_urls() ?
Comment #4
modstore CreditAttribution: modstore commentedBecause the only call the the _print_rewrite_urls() function is with a pattern to match a href's, it is necessary to call with a pattern matching img's as well.
Comment #5
jcnventura CreditAttribution: jcnventura commentedCommitted to dev, without the duplicate img calls. Please test.
Comment #6.0
(not verified) CreditAttribution: commentedquoted code formatting