wkhtmltopdf/wicked_pdf : some external pictures are not displayed
-
27-05-2021 - |
Question
I'm trying to export a page in my rails app to a pdf using wkhtmltopdf/wickedpdf (both the latest version, so is rails). However, external images from facebook (obviously with an absolute url) are not displayed : I got the classic empty box with a '?' when pictures are missing. The HTML version is just fine.
I tried with other pictures from other sources, and it worked as expected. Only fb pictures are causing troubles. However I absolutely need those.
Any ideas? Thanks for your time!
Solution 2
Ok so it looks like I was using a bad version of wkhtmltopdf. Had to try several before getting to the right, this is the one that did the trick for me.
@Hoang's answer is another possible solution.
OTHER TIPS
You should download the image into the app and use absolute path for image in pdf template, like
"#{RAILS_ROOT}/public/path-to-fb-image}"