简体   繁体   English

在dompdf中设置页脚

[英]Setting footer in dompdf

This is the required behavior (jsfiddle). 这是必需的行为 (jsfiddle)。

<!--Footer-->
<div id="footer">
<span class="alignleft">$unique_ID</span>
<span class="alignright"> Page <span class="pagenum"></span></span>
<div style="clear: both"></div>
</div>



.footer {
width: 100%;
position: fixed;
}
.footer {
bottom: 0px;
}

.pagenum:before {
content: counter(page);
}
.alignleft {
float: left;
}
.alignright {
float: right;
}

在此处输入图片说明 But when using the exact same code in the html which the dobmpdf uses to render following is the result 但是,当在dobmpdf用于呈现以下内容的html中使用完全相同的代码时,结果是 在此处输入图片说明

How to solve this problem. 如何解决这个问题呢。 ($unique_ID is a php variable) ($ unique_ID是一个php变量)

Dompdf up to and including version 0.6.2 does not have float support enabled by default. 默认情况下,Dompdf 0.6.2版及更高版本未启用浮动支持。 Modify your dompdf_config.custom.inc.php file such that the DOMPDF_ENABLE_CSS_FLOAT configuration constant is set to true. 修改您的dompdf_config.custom.inc.php文件,以便将DOMPDF_ENABLE_CSS_FLOAT配置常量设置为true。

Dompdf up to and including version 0.7.0 does not support auto-calculated width. Dompdf版本0.7.0及更高版本不支持自动计算的宽度。 So even enabling float will not be enough for these versions. 因此,即使启用浮点功能也无法满足这些版本的需求。 You will need to add a width to your floated elements for them to display correctly. 您需要为浮动元素添加宽度,以使其正确显示。

Dompdf 0.7.1 and later should render this as expected. Dompdf 0.7.1及更高版本应按预期呈现。

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

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