pessoal,
como faco para que o cabecalho e rodape do rel. eu usar em toda a aplicacao
sds
helder
Autor: helder marques lima lima
pessoal,
como faco para que o cabecalho e rodape do rel. eu usar em toda a aplicacao
sds
helder
Autor: helder marques lima lima
44 comentários
Class RelatorioPDF extends TPDF
{
public function __construct($strOrientation = 'P', $strUnit = 'mm', $strFormat = 'A4', $strFontFamily = 'arial', $intFontSize = 8)
{
parent::__construct($strOrientation, $strUnit, $strFormat, $strFontFamily, $intFontSize );
}
// método para escriver no cabeçalho da página
public function header()
{ //Logo : a imagem tem que existir senão dá erro
//$this->Image('./imagens/brasao.jpg',$this->lMargin,1,16,17); $this->setY(3); $this->SetFontSize(14);
$this->cell(0,5,'CABECALHO DO RELATÓRIO',null,1,'C');
$this->SetFontSize(12);
$this->cell(0,5,'SUBTÍTULO DO RELATÓRIO',null,1,'C'); // traçar a linha
$this->setY(18);
$this->cell(0,2,'','T',1);
}
// método para escriver no rodaçé da página
public function footer()
{
//posicionar em 1.5 cm do rodapé
$this->SetY(-15);
//Arial italic 8
$this->SetFont('','I',8);
//Número da página
$this->Cell(0,5,'Pág '.$this->PageNo().'/{nb}','T',0,'C');
$this->cell(0,5,'Emitido em:'.date('d/m/Y H:i:s'),0,0,'R');
}
}
?> Este será o PAI de todos os seus relatórios. Quando for criar um novo relatório faça assim: <?php
/*
$rel = new RelatorioPDF(); // pagina 1
$rel->AddPage();
$rel->cell(0,5,'Linha 1',0,1,'l');
$rel->cell(0,5,'Linha 2',0,1,'l');
$rel->cell(0,5,'Linha 3',0,1,'l');
$rel->cell(0,5,'Linha 4',0,1,'l');
$rel->cell(0,5,'Linha 5',0,1,'l'); // pagina 2
$rel->AddPage();
$rel->cell(0,5,'Linha 1',0,1,'l');
$rel->cell(0,5,'Linha 2',0,1,'l');
$rel->cell(0,5,'Linha 3',0,1,'l');
$rel->cell(0,5,'Linha 4',0,1,'l');
$rel->cell(0,5,'Linha 5',0,1,'l'); // criar o pdf no browser
$rel->show();
?> Abraço.