gpt4 book ai didi

html - 在dompdf中制作一个图像覆盖所有的第一页

转载 作者:行者123 更新时间:2023-11-28 02:59:02 24 4
gpt4 key购买 nike

我正在尝试获取一张图片来填充 dompdf pdf 的整页,之后的每一页都有页眉和页脚。使用下面的代码,它会创建附加的图像。我已经做了我能想到的一切来纠正这个问题,包括将所述图像的大小调整为 595px x 842px(A4 纸张大小)。我需要做些什么特别的事情吗?

$html .="<style> 
@page {
margin-top:130px;
}
body {
font-family: Arial, Helvetica, sans-serif;
}
.flyleaf {
page-break-after: always;
margin:-130px;
padding:0;
}
.flyleaf img {
min-width: 100%;
min-height: 100%;
}
.header,
.footer {
width: 100%;
text-align: center;
position: fixed;
}
.header {
top: -110px;
}

.footer {
bottom: 0px;
}
</style>";
$html .='<div class="flyleaf" width="100%"><img style="max-width:100%;max-height:100%;" src="'.$header.'"></div>';
$html .='<div class="header">';
$html .='<td style="width:100px;"><img src="'.$logo.'"></td>';
$html .='</div>';
$html .='<div class="page">';
$html .='//Page content here';
$html .='</div>';
$html .='<div class="footer">';
$html .='//Footer content here';
$html .='</div>';

Image Example

最佳答案

对我很有帮助的是像这样为封面制作框架:

#cover_sheet {

position : absolute;

top : 0px;
left : 0px;
right : 0px;
bottom : 0px;

overflow : hidden;
margin : 0;
padding : 0;
}

应该可以在那里以正确比例输入 .svg 图像。

一个有助于检查的页面是 http://eclecticgeek.com/dompdf/debug.php

关于html - 在dompdf中制作一个图像覆盖所有的第一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35484400/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com