2012-07-25 60 views
2

我在rails 3.0项目中使用了wicked_pdf插件。我想用css文件内的图像来定义背景。如何在CSS中使用背景图片wicked_pdf

这里是我的CSS代码

.thumb-image { 
    background: url(http://localhost:3000/images/pdf/ideathumbbg.png) no-repeat left top; 
    width: 1979px; 
    height: 946px; 
    position: relative; 
    padding: 54px; 
    text-align: center; 
    margin-bottom: 15px; 
} 

这不找到ideathumbbg.png,它并呈现ideathumbbg.png中产生的PDF文件。

是否可以在css文件中使用wicked_pdf_image_tag helper?或者解决这个问题的其他最佳解决方案?

+0

是否有图像URL的任何单引号 – Ross 2012-07-25 13:54:30

+0

不存在图像URL – Sunny 2012-07-25 14:34:40

+0

没有单引号,你必须是在你的日志中得到一些错误,你可以检查确切的url rails试图访问....你必须看到的东西作为呈现http:// localhost:3000/images/pdf/ideathumbbg.png – Ross 2012-07-25 14:55:53

回答

2

Wkhtmltopdf不能渲染或PNG图像作为背景:

http://code.google.com/p/wkhtmltopdf/issues/detail?id=544

试试你的背景图像转换为JPG格式。

+0

谢谢Unixmonkey,我试过这与jgp图像,但仍然不起作用 – Sunny 2012-07-26 04:09:57

+0

建议:你解决了你的问题,然后请张贴您的解决方案,并将其标记为正确的答案 – Ross 2012-07-26 04:16:57

+0

嗨罗斯, Unixmonkey上面提到的解决方案不适合我。 – Sunny 2012-07-26 06:57:25