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