1

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?

El Kopyto
  • 1,157
  • 3
  • 18
  • 33

1 Answers1

6

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.

lazzy_ms
  • 1,169
  • 2
  • 18
  • 40
InToSSH
  • 160
  • 2
  • 10
  • I guess session is the problem - when I logged out, I was no longer able to load the image in browser with direct url. THANKS! – El Kopyto Jan 14 '13 at 15:00
  • You are welcome :) I had the same problem, had to make separate controller which is not restricted by login and check it with SUL. If this was the solution, please mark this answer as Solution for the others. – InToSSH Jan 14 '13 at 19:42
  • Very nice catch/guess on the possible problem +1. There was one similar question like this earlier on in the wkhtmltopdf tag, if I have the time I'll try to find it later and link to your answer. – Joel Peltonen Jan 14 '13 at 19:45