akei9
akei9

Reputation: 45

Using easyTable with FPDI in PHP

I'm trying to generate PDF using FPDF - easyTable and FPDI (beacuse I need to use template of pdf file) and it's not working. I get an error:

Fatal error: Class 'setasign\Fpdi\FpdfTpl' not found in C:\xampp\htdocs\TestFPDI\fpdi\src\Fpdi.php on line 24

I make every step like written here: fpdf-easytable/using-easytable-with, but it's still not working.

Here is my php code:

<?php 

  include 'fpdf.php'; 
  include 'fpdi.php'; 
  include 'exfpdf.php'; 
  include 'easyTable.php'; 

  $pdf = new exFPDF(); 

  $pdf->AddPage('L'); 
  $pdf->AddFont('arial_ce','','arial_ce.php');
  $pdf->AddFont('arial_ce','I','arial_ce_i.php');
  $pdf->AddFont('arial_ce','B','arial_ce_b.php');
  $pdf->AddFont('arial_ce','BI','arial_ce_bi.php');
  $pdf->SetFont('arial_ce', '', 9);

  $pdf->setSourceFile("example-2.pdf"); 
  $tplIdx = $pdf->importPage(1); 
  $pdf->useImportedPage($tplIdx);

  $table1=new easyTable($pdf, 2); 
  $table1->easyCell('Sales Invoice', 'font-size:30; font-style:B; font-color:#00bfff;'); 
  $table1->easyCell('', 'img:fpdf.png, w80; align:R;'); 
  $table1->printRow(); 

  $pdf->Output(); 

?>

Upvotes: 0

Views: 1269

Answers (1)

akei9
akei9

Reputation: 45

I found resolution for my problem so I post it here:

After add use \setasign\Fpdi\Fpdi in exFPDF file everything is working great.

use \setasign\Fpdi\Fpdi;
class exFPDF extends FPDI {

}

Thanks for trying!

Upvotes: 0

Related Questions