使用以下代码时,我的页脚会超出页面(并且不可见):
$footer = $pdf->open_object();
$w = $pdf->get_width();
$h = $pdf->get_height();
$size = 10;
$color = array(.24,.65,.04);
$font = Font_Metrics::get_font("verdana", "bold");
$text_height = Font_Metrics::get_font_height($font, $size);
$text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
$width = Font_Metrics::get_text_width($text, $font, $size);
$pdf->page_text (16 , $y-15, $text, $font, $size, $color);
这样,页脚就会被添加,但只有一部分文字是可见的。有什么想法吗?
答案 0 :(得分:0)
dompdf执行布局,然后使用渲染库生成PDF。渲染库不了解dompdf,因此无法使用其布局引擎。也就是说,当您直接使用PDF呈现库编写页眉/页脚脚本时,您必须自己处理布局。
如果你想让dompdf执行布局,请使用CSS作为页眉/页脚。这个问题的答案概述了创建页眉/页脚的两种方法:stackoverflow.com/q/7484318/264628。