Urgent help for pdf

Posted on 2005-04-18
Last Modified: 2008-01-09
I am trying to open a pdf. I downloaded fpdf class from a site and tried to do the first tutorial but getting the following mistakes:

Warning: setfont(helveticab.php): failed to open stream: No such file or directory in /home/dsgmotor/public_html/FPDF153/fpdf.php on line 550

Warning: setfont(helveticab.php): failed to open stream: No such file or directory in /home/dsgmotor/public_html/FPDF153/fpdf.php on line 550

Warning: setfont(): Failed opening 'helveticab.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/dsgmotor/public_html/FPDF153/fpdf.php on line 550
FPDF error: Could not include font metric file

The code i have is just as follows:


$pdf=new FPDF();
$pdf->Cell(40,10,'Hello World!');

Maybe its the path?
Question by:act1ve
    LVL 7

    Accepted Solution

    Verify /home/dsgmotor/public_html/FPDF153/font/helveticab.php exists.

    Then make sure it is world readable/executable...  chmod 0555 the php files in the font folder. If apache is nobody and file is owned by somebody (presumbably DSGMotors) then the file might not be found on this basis.

    Other that that, your invocation seems correct.

    Related functions; pardon me, "methods".

    function _getfontpath()
          if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font'))
          return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';

    function SetFont($family,$style='',$size=0)
          //Select a font; size given in points
          global $fpdf_charwidths;

          elseif($family=='symbol' || $family=='zapfdingbats')
          //Test if font is already selected
          if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
          //Test if used for the first time
                //Check if one of the standard fonts
                            //Load metric file
                            if($family=='times' || $family=='helvetica')
                                  $this->Error('Could not include font metric file');
                      $this->Error('Undefined font: '.$family.' '.$style);
          //Select it
                $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));

    LVL 6

    Expert Comment

    From the documentation : (install.txt)
    Metric files can be accessed from three different locations:
    - the directory defined by the FPDF_FONTPATH constant (if this constant is defined)
    - the font directory located in the directory containing fpdf.php (as it is the case in this archive)
    - the directories accessible through include()
    Here is an example defining FPDF_FONTPATH (note the mandatory final slash):
    If the files are not accessible, the SetFont() method will produce the following error:
    FPDF error: Could not include font metric file

    maybe you should move the file helveticab.php in same directory where your fpdf.php is? for instance
    try to copy helveticab.php in /home/dsgmotor/public_html/FPDF153/ folder
    LVL 7

    Expert Comment

    What was the problem?

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    As this topic comes over and over again in different forms, I've finally decided to write a short (yea, right...) article / tutorial about pagination with PHP with MySQL database. There are dozens of these kind of tutorials, I know - I wanted to mak…
    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now