I'm using wkhtmltopdf in a Rails app and trying to set a border by placing an image with just borders as the background-image for another. (I'm doing this because box-shadow is not working for wkhtmltopdf). This shows up fine in the HTML view, but in the pdf it doesn't work. My CSS is here:
.box{
background-image: url('/assets/posts/background_border.jpg');
background-repeat: no-repeat;
height: 100px;
width: 100px;
}
Please let me know how to solve this. Thanks!
Make the URL for the background image absolute.
background-image: url('http://localhost:8080/assets/posts/background_border.jpg');
I had the same problem and finally i solved it. I get
Exit with code 1 due to network error: ContentNotFoundError
from wktohtml
To solve just remove quote from url declaraion, absolute url is also required. So change
background-image: url('/assets/posts/background_border.jpg')
To
background-image: url(http://absolute_url_to_image_without_quote)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With