【发布时间】:2017-06-05 08:11:47
【问题描述】:
我正在使用 xhtml2pdf 库生成一个 pdf,我对背景图像有一个奇怪的情况。
图像已显示但不适合@page,它的设置类似于这样
@page {
size: {% block page_size %}A4 {% endblock %};
background: url("{% static 'folder/background.png' %}") no-repeat center center fixed;
@frame content_farme {
margin-top: 70pt;
margin-bottom: 60pt;
margin-left: 30pt;
margin-right: 30pt;
@bottom-right {
font-size: 10px;
margin: 40pt -10pt 0 0;
{% block page_foot_extra_styles %}{% endblock %}
content: {% block page_foot %}"Page " counter(page) " of " counter(pages){% endblock %};
}
@top-left {
font-size: 10px;
font-weight: bold;
{% block page_header_extra_styles %}{% endblock %}
content: {% block page_head %}{% endblock %};
}
}
}
我希望将它放在我的 @page 中,我已经尝试了所有方法,因为我了解标准的 css 属性不能正常工作,所以我如何在 xhtml2pdf 中缩放这个 background是 docs 中一个不错的 test 文件,但我觉得它没有用,有人遇到过这种问题吗?你是如何解决的。
【问题讨论】:
标签: html css django pdf xhtml2pdf