FPDF -PHP -Call to undefined method
<p>I have been stuck on trying to print an array of data into a table in fpdf.
This is the tutorial I was following: 
<a href="http://www.fpdf.org/en/tutorial/tuto5.htm" rel="nofollow">http://www.fpdf.org/en/tutorial/tuto5.htm</a></p>

<p>Except it keeps saying:</p>

<blockquote>
  <p>Fatal error: Uncaught Error: Call to undefined method FPDF::FancyTable() in ...</p>
</blockquote>

<p>I have seen many other questions like this but none of them are fixing mine. </p>

<p>I feel like this should be a really easy fix and I'm doing something dumb. </p>

<p>Any help would be greatly appreciated.</p>

<pre><code>&lt;?php
require('../fpdf/fpdf.php');

class PDF extends FPDF
{
    // Colored table
function FancyTable($header, $data)
{
    // Colors, line width and bold font
    $this-&gt;SetFillColor(255,0,0);
    $this-&gt;SetTextColor(255);
    $this-&gt;SetDrawColor(128,0,0);
    $this-&gt;SetLineWidth(.3);
    $this-&gt;SetFont('','B');
    // Header
    $w = array(40, 35, 40, 45);
    for($i=0;$i&lt;count($header);$i++)
        $this-&gt;Cell($w[$i],7,$header[$i],1,0,'C',true);
    $this-&gt;Ln();
    // Color and font restoration
    $this-&gt;SetFillColor(224,235,255);
    $this-&gt;SetTextColor(0);
    $this-&gt;SetFont('');
    // Data
    $fill = false;
    foreach($data as $row)
    {
        $this-&gt;Cell($w[0],6,$row[0],'LR',0,'L',$fill);
        $this-&gt;Cell($w[1],6,$row[1],'LR',0,'L',$fill);
        $this-&gt;Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill);
        $this-&gt;Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill);
        $this-&gt;Ln();
        $fill = !$fill;
    }
    // Closing line
    $this-&gt;Cell(array_sum($w),0,'','T');
}
}

$csv = array();

$lines = file('../data/StaffData.csv', FILE_IGNORE_NEW_LINES);

foreach ($lines as $key =&gt; $value)
{
    $csv[$key] = str_getcsv($value);
}

$pdf = new FPDF();

// Column headings
$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. ');
$data = $csv;
 $pdf-&gt;AddPage();

$pdf-&gt;FancyTable($header,$data);
$pdf-&gt;Output();

?&gt;
</code></pre>

<p>**UPDATE **<br>
-Thanks for the help.
I did change the font and made no difference. I changed it from:</p>

<pre><code>$this-&gt;SetFont('','B');
</code></pre>

<p>to</p>

<pre><code>$this-&gt;SetFont('Arial','',14);
</code></pre>

<p>(In the fancy table function)</p>

<p>But it comes up with heaps of these errors:</p>

<blockquote>
  <p>Warning: number_format() expects parameter 1 to be float, string given in /Applications/XAMPP/xamppfiles...</p>
  
  <p>Notice: A non well formed numeric value encountered in /Applications/XAMPP/xamppfiles...</p>
  
  <p>Fatal error: Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file in /Applications/XAMPP/xamppfiles...</p>
</blockquote>

<p>I'm sorry, but I don't really know what to do.</p>

<p>However, I got some of the table to display by removing the lines with number_format. I.E I removed these two lines:</p>

<pre><code>  $this-&gt;Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill);
  $this-&gt;Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill);
</code></pre>

<p>Any reason why? Its displaying the first two columns but not the rest of it.</p>