简体   繁体   English

wicked_pdf css背景图片未显示

[英]wicked_pdf css background image not showing

I'm using wicked_pdf in Ruby-on-Rails to generate a PDF and I want to set a background image on the body element.我在 Ruby-on-Rails 中使用 wicked_pdf 生成 PDF,我想在 body 元素上设置背景图像。 I've linked a stylesheet with stylesheet_link_tag wicked_pdf_asset_base64("pdf.css") and now I want to import the image as base64 (linking to the image file to save looking at the code inline).我已将样式表与stylesheet_link_tag wicked_pdf_asset_base64("pdf.css")链接起来,现在我想将图像导入为 base64(链接到图像文件以保存查看内联代码)。

Sass code:萨斯代码:

body
  background: asset-url('pdf-background.png')

It works in debug mode but not rendered as a PDF.它在调试模式下工作,但不呈现为 PDF。

body
  background: asset-data-url('pdf-background.png')

Thanks to @pbrueske https://stackoverflow.com/a/30187719/203915感谢@pbrueske https://stackoverflow.com/a/30187719/203915

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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