Re: PDFlib error 2516
| From: | Jyry Kuukkanen | Date: | Fri, 16 Jan 2004 07:29:49 +0000 |
| Subject: | Re: PDFlib error 2516 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174762@lists.php.net to get a copy of this message | ||
On Thu, 15 Jan 2004, Mark Wouters wrote:
> Hello!
>
> Tried out this simple script from a tutorial on creating PDF with PHP:
>
> <?php
>
> $pdf = PDF_new();
> PDF_open_file($pdf, "testpdf.pdf");
>
> PDF_set_info($pdf, "Author", "Someone");
> PDF_set_info($pdf, "Title", "PDF creation with PHP");
> PDF_set_info($pdf, "Creator", "Someone");
> PDF_set_info($pdf, "Subject", "Creating PDFs");
>
> PDF_begin_page($pdf, 595, 842);
>
> $arial = PDF_findfont($pdf, "Arial", "host", 1);
> PDF_setfont($pdf, $arial, 14);
>
> PDF_show_xy($pdf, "Pricelist", 40, 780);
>
> PDF_end_page($pdf);
>
> PDF_close($pdf);
>
> ?>
>
> However got this error:
>
> Fatal error: PDFlib error: [2516] PDF_findfont: Metrics data for font
> 'Arial' not found in
> /usr/local/psa/home/vhosts/resilion.be/httpdocs/test/createpdf.php on line
> 23
>
> Does anyone have an idea what the problem could be? What does the "host"
> mean in the example above ($arial = PDF_findfont($pdf, "Arial", "host",
> 1); )?
>
> Thanks for any help!!!!
>
> Mark.
Hello
It very much looks like you are running your script under Un*x.
That is why "Arial" font is not found when using "host" setting. You
should use "Helvetica" instead. The host refers to font selection
available to PDFlib.
I tried a year or so ago setting up PDFlib so that I could use other than
"host" with no luck. As I did not need more than those three basic fonts,
I spent no more time sorting out the other options.
Take a look at sopdf.php that you can found from dataxi.sourceforge.net,
and download latest solib-ver.tar.gz that contains the script. It is a
fully functional class to produce PDF using PDFlib.
Cheers,
--
--Jyry
C|:-( C|:-/ C|========8-O C|8-/ C|:-(