Reputation: 196
I'm using Cpdf by Wayne Munro, which is working very well for creating PDFs with PHP. However, I can't seem to use any font but the built-in Helvetica. The class comes with a /fonts directory loaded with *.afm files. I've reviewed the documentation, but just can't seem to figure it out. I've tried exhaustive Google searches, but I'm not finding anything.
Can anyone lead me in a helpful direction?
Thanks!
Jay
Upvotes: 1
Views: 756
Reputation: 1935
Typically pointing to the ttf font isn't enough for cpdf... you also need a supporting "afm" or "ufm" file, which basically describes the font to cpdf, so when its placing characters, it has a quick lookup to know their size and other details.
I would suggest that you look at DOMPDF now though:
https://github.com/dompdf/dompdf
It also typically uses cpdf in the background... which you can use directly from "./lib/class.pdf.php" (it has been edited for Unicode support).
It in also provides several ttf/ufm fonts, or you can generate them yourself from a script they provide (which can be a bit tricky to get working), or use the service at:
http://eclecticgeek.com/dompdf/load_font.php
Upvotes: 0