1
I need the contents $pdf->MultiCell
be customized(html) with bold, etc...
<?php
require_once( 'fpdf.php' );
$nome = @$_POST['nome']; // Sim, a supressão é perfeitamente válida neste contexto
$horas = @$_POST['horas']; // pois os parâmetros serão checados logo em seguida.
$data = @$_POST['omail'];
$datan = @$_POST['datan'];
class PDF extends FPDF
{
// Page header
function Header()
{
// Logo
$this->Image('cabecalho.png',-20,2,250);
// Arial bold 15
$this->SetFont('Arial','B',15);
// Move to the right
$this->Cell(80);
// Line break
$this->Ln(20);
}
// Page footer
function Footer()
{
// Logo
$this->Image('rodape.png',-20,270,250);
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(210,-17,'Página '.$this->PageNo().'/{nb}',0,0,'C');
}
}
// Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$pdf->SetFont('Arial','', 10);
$pdf->SetXY( 10, 50 );
$pdf->MultiCell( 190, 6,
"Caro $nome
[b]CONTRATADA</b>");
$pdf->Output();
?>
I’d still prefer the
isset
at the@
, something likeif (isset($_POST['nome'], $_POST['horas'], $_POST['omail'], $_POST['datan'])) { ... executa aqui dentro .... }
, with @the error log is triggered internally yet, the performance is not a great thing and still breaking without the IF can check there and cause a PDF malformed and unexpected.– Guilherme Nascimento
Whenever posting this type of doubt, reduce the code to a [mcve], and explain the difficulty better, so the post is more suitable within the objectives of the site.
– Bacco