0
I have a problem with the mpdf and I really need help.
I can’t put the header and footer in the report for nothing, even putting SetHTMLFooter
and the SetHTMLHeader
doesn’t work.
I tried version 7.0, 6.1, 6.0 and 5.7 and nothing....
I am not php programmer, this system fell in my lap.
Follow the code:
$CSS:
<style>
@page {
margin-left: 20px;
margin-right: 20px;
margin-top: 15px;
margin-bottom: 15px;
}
#cabecInicial{
font-family: 'Century Gothic';
color: #3864B2;
background-image: url('imgs/cabecalho_relatorios_1_grande.png');
background-position: right top;
background-repeat: no-repeat;
background-size: 70% 120%;
background-color: #efefef;
height: 160px;
width: 100%;
}
#corpoCabecInicial{
height: 115px;
width: 100%;
float: left;
margin-top: 15px;
}
#dadosCabec {
float: left;
margin-left: 15px;
width: 430px;
}
#corpoRelatCompleto{
height: auto;//100%;//200px
width: 100%;//1035
margin:0 auto;
}
.esquerdaEspaco10 {
padding-left: 5px;
}
.subtitulo{
font-weight: bolder;
vertical-align: top;
}
.apertoDeMao{
width: 154px;
}
.apertoDeMaoMini{
float: left;
width: 78px;
margin: 8px;
}
#infoCabecInicial {
vertical-align: bottom;
font-size: 12px;
}
#obsCabec{
opacity: 0.7;
background: #144385;
padding-left: 10px;
padding-right: 5px;
padding-top: 20px;
padding-bottom: 20px;
margin-left: 20px;
margin-top: 5px;
margin-right: 20px;
width: 230px;
height: auto;
color: #fff;
float: right;
border-radius: 15px 15px 15px 15px;
box-shadow: 3px -4px 3px 0px #336abd;
}
.textoFooter {
margin-top: 20px;
padding-right: 15px;
float: right;
color: #ffffff;
}
.footer {
background: url('imgs/footerGambi.png');
background-repeat: no-repeat;
background-size: 100%;
width: 100%;
height: 50px;
text-align: right;
clear: both;
//page-break-after:always;
//position: fixed;
}
.basicHeader {
background-image: url('imgs/cabecalho_relatorios_1.png');
background-position: right top;
background-repeat: no-repeat;
background-size: 70% 180%;
background-color: #efefef;
width: 100%;
height: 70px;
clear: both
font-size: 12px;
float: left;
position: fixed; top: 0px;//page-break-after:always;
}
.textoCabecGeral {
float: left;
font-size: 26px;
color: #3864B2;
width: 500px;
}
#corpoRelat {
margin-top:65px;
font-family: 'Tw Cen MT';
font-size: 12.0pt;
}
.indice {
font-size: 22pt;
border-bottom: 1px double;
padding-bottom: 5px;
}
.numeroIndice {
padding-right: 15px;
}
.subIndice {
font-weight: bolder;
}
.tabelaSistema {
width: 100%;
border-collapse: collapse;
margin-bottom: 35px;
}
.tabelaSistema td{
border: 1px solid #000000;
}
.tabelaSistema th{
border: 1px solid #000000;
}
.tabelaSistema .tdLess {
width: 15%;
text-align: center;
}
.tabelaSistema .first {
text-align: left;
padding-left: 15px;
}
#cabecTable {
width: 100%;
}
</style>
$header:
<div class="basicHeader">
<table>
<tbody><tr>
<td><img src="./2016.07.12 relato_de_resultados_-----.pdf_files/maoGambi.png" class="apertoDeMaoMini"></td><td>
</td><td><!-- textoCabecGeral-->
<div class="textoCabecGeral subtitulo">
RELATO DIÁRIO
<br>Nível de -------------
</div>
</td><td>
</td></tr>
</tbody></table>
</div>
</div>
$footer
<div class="footer">
<div class="textoFooter">
VITEC - VP Tecnologia da Informação
</div>
</div>
$body
<div id="corpoRelatCompleto">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel augue euismod erat hendrerit tempus. Nunc vehicula ex nec consequat efficitur. Praesent felis est, laoreet quis bibendum at, dictum sed tortor. Vivamus et magna at nulla egestas tempor. Phasellus at volutpat magna. In pretium sem egestas luctus porta. Etiam sed interdum neque. Duis a enim sit amet diam tempor efficitur at non magna.
</p>
.......
</div>
report generation code:
$inicioCorpo= "<div id='corpoRelatCompleto'>";
$fimCorpo="</div>";
$pdfCompleto = $css.$inicioCorpo.$corpo.$fimCorpo;
$mpdf = new mPDF();
$mpdf->SetHTMLHeader($header, "O");
$mpdf->SetHTMLHeader($header, "E");
$mpdf->SetHTMLFooter($footer, "E");
$mpdf->SetHTMLFooter($footer, "O");
$mpdf->charset_in='windows-1252';
$mpdf->WriteHTML($pdfCompleto);
$mpdf->Output();
exit;
only the header and footer that do not go?
– Hiago Souza
Do not duplicate the question in others 1, 2 you can edit it anytime by adding new details.
– rray
this adds the header and footer, the rest is working perfectly
– user3061516