0
我遇到FPDF问题,因为我的类扩展它不工作。FPDF类扩展不起作用
我创建一个类为我的页脚,然后用调用它:
$pdf = new PDF2();
我有一个外部文件中的代码与包括以上所有的代码,就像这样:
include"fpdf.php";
class PDF2 extends TFPDF
{
// Page footer
function Footer()
{
// MB LOGO 30cm before the end of the page
$Y = $this->SetY(-65);
// Arial italic 8
$this->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$this->SetFont('DejaVu','',10);
//MB LOGO
$this->Image('img/multibanco.jpg',20,$Y,30);
}
}
//pdf begins
// Cliente info encomenda
$pdf = new tFPDF();
$pdf = new PDF();
$pdf = new PDF2();
$pdf->addPage();
// Arial bold 15
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$pdf->SetFont('DejaVu','',11);
// Title
$pdf->Cell(190,10,'Ordem Nº '.$maxi.'',0,0,'C');
// Line break
$pdf->Ln(20);
// Add a Unicode font (uses UTF-8)
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$pdf->SetFont('DejaVu','',10);
// Cliente nome/email
$pdf->Cell(150,10,'Cliente: '.$enc['nome'].' '.$enc['apelido'].' ',0,1);
$pdf->Cell(150,10,'Email: '.$enc['email'].'',0,1);
$pdf->setFillColor(232, 232, 232);
//Messagem
$pdf->RoundedRect(10, 50, 190, 10, 3.5,TRUE);
$pdf->Cell(190,10,'Mensagem',0,1,'L'); //header
$pdf->setFillColor(255, 255, 255); // background
$pdf->MultiCell(180,5,'Text',0,'J',0); // MENSAGEM
//TABELA
$html ='';
$html='<table border="0">
<tr>
<td width="230" height="40" bgcolor="#e6e6e6">Tipo</td>
<td width="88" height="40" bgcolor="#e6e6e6">Formato</td>
<td width="88" height="40" bgcolor="#e6e6e6">Nº Interno</td>
<td width="88" height="40" bgcolor="#e6e6e6">Revelar</td>
<td width="88" height="40" bgcolor="#e6e6e6">Digitalizar</td>
<td width="88" height="40" bgcolor="#e6e6e6">Edição</td>
<td width="88" height="40" bgcolor="#e6e6e6">Impressão</td>
</tr>';
while($pdf_info2 = $smth->fetch(PDO::FETCH_ASSOC)) {
$html .= '
<tr>
<td width="230" height="40" bgcolor="#f7f7f7">'.$pdf_info2['Tipo'].'</td>
<td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['Formato'].'</td>
<td width="88" height="40" bgcolor="#f7f7f7"> </td>
<td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['Revelar'].'</td>
<td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['Digitalizar'].'</td>
<td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['Edicao'].'</td>
<td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['Impressao'].'</td>
</tr>';
}
$pdf->WriteHTML($html);
//OUTPUT + LN
$pdf->Ln(10);
$pdf->Output();
不显示任何类错误,至少我没有看到他们,即使没有error_reporting(0)评论。
类tFPDF()通过使用'的error_reporting(E_ALL)启用错误报告; ini_set('display_errors',1);' –
我不相信“fpdf.php”包含TFPDF的类定义。 – bassxzero