wkhtmltopdf not displaying images - certificate template for testing

markusd1984
Forums

I had the problem that images were not displayed in certificates via wkhtmltopdf turns out that my server can't access itself via servername

curl http://myservername.com

curl: (6) Could not resolve host: myservername.com 

but I was able to access via ip address curl myserveripaddress which therefore worked using it in my certificate template image urls ie. src="http:///profiles/opigno_lms/themes/platon/img/true.png"

Here a test sample you can use in a certificate template to test printing images

Test to display images in a certificate
<br><br> Image via http servername:
<img alt="http via servername url NOT displaying the image" src="http://MY-OPIGNO-SERVERDOMAIN.COM/profiles/opigno_lms/themes/platon/img/true.png">
<br><br> Image via http server ip address:
<img alt="http via IP url NOT displaying the image" src="http:///profiles/opigno_lms/themes/platon/img/true.png">
<br><br> Image via direct path:
<img alt="direct path url NOT displaying the image" src="/profiles/opigno_lms/themes/platon/img/true.png">

markusd1984

Avoid shell output corrupting %PDF using &quot;--quiet&quot;option

I came across the issue that the PDF was not opening in Adobe Acrobat reader via IE, 

turns out some of the shells script was printed before "%PDF" 

Loading pages (1/6) [> ] 0% [======> ] 10% [======> ] 10% [=============> ] 22% [==================> ] 31% [===========================> ] 45% [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [============================================================] Page 1 of 1%PDF

 

This can be avoided using the "--quiet" option in /admin/config/user-interface/print/pdf/wkhtmltopdf