Search code examples
pdfblobimagewkhtmltopdf

wkhtmltopdf, images loaded from db not showing


I am using wkhtmltopdf to convert html to pdf. All images are displayed properly, but the one returned by controller (stored in db, as mediumblob type) is not showing. First I thought this can be a timing issue, so I increased the delay:

--javascript-delay 5000

with no success.

image src:

<img src="/app-name/company/logo"/>

Image is displayed properly on html with the same link.

I tried to change the source to direct path:

<img src="http://localhost:8080/app-name/company/logo"/>

but it didn't help. What can be an issue?


Solution

  • What version of wkhtmltopdf do you have?

    I have installed the newest one http://wkhtmltopdf.org version 0.11.0 and had some problems with this version, I got version 0.9.9 which works fine.

    Also check if you are using for example sessions in your controller/view, the loading from database might depend on it (for example some login info), when using wkhtmltopdf you dont have session data stored.