PDF with PHP creation. Encoding problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

PDF with PHP creation. Encoding problem

Post by basdog22 »

I am using php 4.3.6 and i am trying to create a pdf file with it's builtin functions. It works fine but when i want to make a file with greek chars like:
Γειά σας τι κάνετε;
I get gliberish :roll:

I know it has something to do with findfont() but i tried a lot of things with no result. I searched but came up with nothing helpful.

Any ideas??
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

I also tried cp1253 as the encoding. Tried pdf_set_font() and builtin as encoding as the pdflib manual describes but still nothing :roll:
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

I have relied on ezPDF to do pretty much everything for me regarding PDF and it works beautifully. The API is quite straightforward.
I am, however, not sure how Greek characters are supported - I suppose you'd need to create the font-file (have a look at the readme file for ezPDF.
Also, there's a helpful discussion forum at http://sourceforge.net/forum/?group_id=45168
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

yes i read about font file creating but...
aren't font files in the pdf related dir of PHP ???

How can i embed the fonts i created so that the pdf uses them and not the default ones???
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

basdog22 wrote:yes i read about font file creating but...
aren't font files in the pdf related dir of PHP ???

How can i embed the fonts i created so that the pdf uses them and not the default ones???
Yes, you can - this tutorial should help you there. You will need to encode the fonts yourself, though. I remember looking into it a while ago and found an open-source app that did exactly that, but I can't find the link atm :(
Post Reply