这里我使用dompdf生成带有标题,正文,页脚的pdf。 但是当我尝试添加页脚时,它没有附加。
它始终带有身体代码, 我想在底部设置一个页脚。
任何人都可以弄清楚以下代码我错了吗?
代码:
global $_dompdf_show_warnings;
global $_dompdf_debug;
global $_DOMPDF_DEBUG_TYPES;
global $_dompdf_warnings;
$_dompdf_show_warnings = FALSE;
require_once(realpath(APPPATH."third_party/dompdf")."/dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
$dompdf = new DOMPDF();
$dompdf->set_paper("letter", "portrait");
$html = '<html>
<head>
<title>
</title>
</head>
`enter code here` <body style="margin:0; background-color:#ff9900; color:#ffffff;">
<div>
<div style="margin:15px;">
<div>
<span style="font-size:25px; font-weight:600;">
Hi, John
</span>
</div>
<div>
<span>
Your account statement is here.
</span>
</div>
<div style="margin-top:15px; border: 2px solid;border-radius:5px; padding:10px; position:absolute; diplay:block;">
<div style="float:left;">left</div>
<div style="float:right;">right</div>
</div>
</div>
</div>
<div style="background-color:#ffffff; color:#ff9900; position:fixed; bottom:0;width:100%;padding:10px;">
<div>
<span>
<b><i>This is a system generated statement.</i></b>
</span>
</div>
<div>
<span>
<b><i> If you have any queries, email support@xyz.com.</i></b>
</span>
</div>
</div>
</body>
</html>';
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("dompdf_out.pdf", array("Attachment" => false));
答案 0 :(得分:0)
在dompdf(最高版本和包括版本0.7.0)中,(一般来说)元素从它们首次出现的页面开始呈现。因此,您希望将任何页眉/页脚内容放在文档的顶部。