Undefined font: In Fpdf

I'm New to Fpdf library, i need to create a pdf from data base in smarty. i have checked the data from data base is fine, when pass the font name the below error was show

Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/irmt/library/class/fpdf/fpdf.php on line 526
<b>FPDF error:</b> Undefined font: helvetica B

my code is

            $pdf->AddPage();
            $pdf->SetFont('Arial','B',14);
            $pdf->FancyTable($result);
            $pdf->Output();

Please help me how can i solve this problem. thank adv

Answers


I think your __construct in the pdf creation is problem, try this one in

    require_once("fpdf.php");
    class pdf extends FPDF
    {
      function __construct()
       {
          parent::FPDF();
       }
    }

that's because you call the constructor of the fpdf library, change the fpdf library function (parameters) to __ construct (parameters), then spread it from your file. example: file : genpdf.php

<?php 
include('fpdf.php');
class Genpdf extends Fpdf{
    public function __construct()
    {
       parent::__construct();
    }
    public function build()
    {
       $this->AddPage();
       $this->SetFont('Arial','B',16);
       $this->Cell(40,10,'¡Hola, Mundo!');
       $this->Output();
    }
}

Try to remove the line $pdf->FancyTable($rs); and check if you get the PDF.


Need Your Help

Razor: @Html.Partial() vs @RenderPage()

asp.net-mvc razor renderpartial

What is the appropriate way of rendering a child template?

Canonical way to obtain CDI managed bean instance: BeanManager#getReference() vs Context#get()

cdi managed-bean

I figured that there are two general ways to obtain an auto-created CDI managed bean instance via BeanManager when having solely a Bean&lt;T&gt; to start with (which is created based on Class&lt;T&...