I am creating a PDF file using PDFLib, and unfortunately, I cannot seem to get it to be able to use the Georgia file. I can use almost any other font, other than that one.
I have tried loading the file, as well as changing the search path, and it still doesn't seem to work. What I've tried so far:
$searchPath = "/Library/Fonts";
$p->set_option("searchpath= {" . $searchPath . "}");
$scoreFont = $p->load_font("Georgia", "unicode", "");
if ($scoreFont == 0){
die("Error: " . $p->get_errmsg());
}
Whenever I include this, it gives me a "Page is not working" error.
I am not sure if it is relevant, but I do see the Georgia.ttf file in the Library/Font directory, but not the System/Library/Font directory. Anyone have any experience with this issue? Any help would be greatly appreciated.
Thank you in advance!
EDIT
I checked my apache logs and I see there is an error, listed as:
Tue Aug 09 11:23:48 2016] [notice] child pid 11501 exit signal Segmentation fault (11)
Also, I checked the PDFLib log file and I see:
PDF_load_font[---------------------------------------------------------------- --------------]
[ PDFlib 9.0.5 PHP5 binding on Mac OS X-10.6 64 (le) 2016-08-09 11:23:48 ]
[ Classes: api=1 warning=1 ]
[ Enter in vi to compile it: ]
[ %s/)$/);/g and %s/"(NULL)"/NULL/g and %s/\[[^]]*\]//g ]
[ Program should run on a little-endian platform ]
[------------------------------------------------------------------------------]
PDF_set_option(p_0x1097619a8, "searchpath= {/Library/Fonts}")
[New category:resource "SearchPath:/usr/local/PDFlib"]
[New category:resource "SearchPath:/usr/local/PDFlib/PDFlib"]
[New category:resource "SearchPath:/usr/local/PDFlib/PDFlib/9.0"]
[New category:resource "SearchPath:/usr/local/PDFlib/PDFlib/9.0/resource/cmap"]
[New category:resource "SearchPath:/usr/local/PDFlib/PDFlib/9.0/resource/codelist"]
[New category:resource "SearchPath:/usr/local/PDFlib/PDFlib/9.0/resource/fonts"]
[New category:resource "SearchPath:/usr/local/PDFlib/PDFlib/9.0/resource/glyphlst"]
[New category:resource "SearchPath:/usr/local/PDFlib/PDFlib/9.0/resource/icc"]
[New category:resource "SearchPath:/Users/{username}/PDFlib"]
[New category:resource "SearchPath:/Users/{username}/PDFlib/PDFlib"]
[New category:resource "SearchPath:/Users/{username}/PDFlib/PDFlib/9.0"]
[New category:resource "SearchPath:/Users/{username}/PDFlib/PDFlib/9.0/resource/cmap"]
[New category:resource "SearchPath:/Users/{username}/PDFlib/PDFlib/9.0/resource/codelist"]
[New category:resource "SearchPath:/Users/{username}/PDFlib/PDFlib/9.0/resource/fonts"]
[New category:resource "SearchPath:/Users/{username}/PDFlib/PDFlib/9.0/resource/glyphlst"]
[New category:resource "SearchPath:/Users/{username}/PDFlib/PDFlib/9.0/resource/icc"]
[New category:resource "SearchPath:/Library/Fonts"]
I am unsure of what either of those entries really mean. In the PDFLib log, the only directory that actually exists in the last one, the /Library/Fonts one. And in that directory is the Georgia.ttf file.
Any ideas?
Thanks!
a quick test with with the above code and the current PDFlib 9.0.7 on OSX works fine. So it might be good idea, to check the error log file of your webserver/PHP. Maybe your webserver don't give the message in the die() case correctly.
When you don't see any error reason in the webserver logfile, you might enable the PDFlib logging,
$p->set_option("logging {filename {/tmp/PDFlib.log}}");
as your first PDFlib call. Then you should see, there, if load_font() failed (0) and the possible error message.
EDIT: thanks for sharing more details from your logfiles. The entry
Tue Aug 09 11:23:48 2016] [notice] child pid 11501 exit signal Segmentation fault (11)
might be an indication about the HostFont Problem on Mac in combination with PHP and Webserver. Can you please disable the hostfont support. In the PDFlib PHP samples this call is commented out, so simple enable the call:
/* Enable the following line if you experience crashes on OS X
* (see PDFlib-in-PHP-HowTo.pdf for details):
*/
$p->set_option("usehostfonts=false");