Fpdf

Hello,i added fpdf/fpdf by composer package to phpmaker 2021.
I use the code below to create pdfs.

       public function rowCustomAction($action, $row)
           {
       use Fpdf/Fpdf;
   $pdf = new FPDF(); 
    $pdf->AddPage('L', 'A3');
    $pdf->SetFont('Arial', 'BU', 14);
    $pdf->Cell(400, 4, 'This is only test FPDF in Custom File', 0, 2, 'C');
    $pdf->Output("Just_Test.pdf", "D"); 
    
                return true;
           }

but get this error: syntax error, unexpected ‘use’ (T_USE)How can I solve this? Thanks for your help

From PHP doc (see Scoping rules for importing :

The use keyword must be declared in the outermost scope of a file (the global scope) or inside namespace declarations. >

You may use it without using “use” keyword, e.g.

$pdf = new \Fpdf\Fpdf();

Thanks!,I had to put this in front of it to avoid an error
ob_end_clean();my code:

 // Row Custom Action event
         public function rowCustomAction($action, $row)
           {
    ob_end_clean();
    $pdf = new \Fpdf\Fpdf('L','mm','A5'); 
    $pdf->SetFont('Arial','',8);
       $pdf->Ln(10);
       $code = $row['code'];
        $naam = $row['naam'];
       $adres = $row['adres'];
       $geboortedatum = $row['geboortedatum'];
       $geslacht = $row['geslacht'];
       $pdf->AddPage();
       $pdf->Cell(60,10,'lerarenkaart 2020 2021',0,0,'L');
       $pdf->Ln();
       $pdf->Cell(80,8,$code,1,0,'L');
       $pdf->Ln();
       $pdf->Cell(80,8,$naam,1,0,'L');
       $pdf->Ln();
       $pdf->Cell(100,8,$adres,1,0,'L');
       $pdf->Ln();
       $pdf->Cell(80,8,$geboortedatum,1,0,'L');
       $pdf->Cell(20,8,$geslacht,1,0,'R');
      $pdf->Output();
                return true;
           }

This PDF will now appear fine. However, only for the first row that I select in custom actions. How can I have this operation performed for the other rows as well?
thanks in advance for your help

You should use Custom Files if you want to output something into .pdf file. You may do anything from Custom Files, such as loop through recordset, create a custom layout for the .pdf file, and so forth.

If you just want to use Fpdf instead of dompdf, you better customize the ExportPdf class, see https://discourse.hkvstore.com/t/customizing-export-v2021/4020/1