简体   繁体   中英

wkhtmltopdf/wicked_pdf : some external pictures are not displayed

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!

您应该将图片下载到应用中,并使用pdf模板中的图片的绝对路径,例如

"#{RAILS_ROOT}/public/path-to-fb-image}"

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM