Urgent help for pdf

Posted on 2005-04-18
Medium Priority
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
  • 2

Accepted Solution

Promethyl earned 2000 total points
ID: 13808386
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));


Expert Comment

ID: 13809169
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

Expert Comment

ID: 13816476
What was the problem?

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month16 days, 1 hour left to enroll

850 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