php - Mpdf 删除标题和正文内容之间的空格
问题描述
我试图删除标题(动态)和正文(动态)之间的空白,但无法使其正常工作。请找到以下图片
我正在为 mpdf 使用以下代码
$mpdf = new Mpdf();
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->setAutoTopMargin = 'stretch';
if ($header != '') {
$mpdf->SetHTMLHeader('<p class="text-center" style="margin:0px;padding: 0px!important">' . $header . '</p>', '', true);
}
if ($footer != '') {
$mpdf->SetHTMLFooter('<p class="text-center" style="margin:0px!important">' . $footer . '</p>', '', true);
}
用于在每个页面上显示页眉和页脚的拉伸
解决方案
尝试添加此配置:
$config = array(
'format' => 'A4',
'mode' => 'utf-8',
'orientation' => 'P'
'margin_top' => -30,
'margin_header' => 2,
'setAutoTopMargin' => 'pad',
);
推荐阅读
- excel - 按标题名称复制列并粘贴到另一个工作簿
- reporting-services - SSRS - 如何在主报表中创建动态子报表
- php - 将内容而不是变量传递给 PHP 函数
- symfony - 传递给 App\Entity\Invitacion::setEmail() 的参数 1 必须是 App\Entity\User 的实例或 null - Symfony 4
- javascript - 尝试渲染从弹性搜索接收到的 JSON 字典但得到 [object Promise] 错误
- php - PHP将单词的第一个字母大写
- laravel - 在 DatabaseSeeder.php 的调用函数中注释时,Laravel 数据库 FooSeeder 仍在播种
- initialization - SwiftUI 视图(显然)在 init 运行之前布局
- joi - 如何验证 Joi 中可选键的必需属性?
- java - EJB 能否产生操作系统进程?