Reputation: 6411
I'm working with flex 4 and need to export some pdf files. I'm useing purePDF library for this. Can anyone explain me how to make possible to write romanian characters in pdf files with purePDF -> I need to write characters like ăîşţ, etc.
I look in the wiki documentation of that library but cannot understand enough what I need. Appreciate any help.
Thanks
Upvotes: 1
Views: 865
Reputation: 6411
I'll ask my own question, taking in consideration that it'll be useful for other one.
Note: Taking in account that purepdf is the iText library equivalent from Java, when you encounter any problems and need documentation, you can consult iText documentation for inspiration with purePDF.
So this is what you need to do:
public static const SERIF_NORMAL : String = "FreeSerif.ttf";
//"assets/fonts/FreeSerif.ttf" is the directory where I copied my *.ttf files
[Embed(source="assets/fonts/FreeSerif.ttf", mimeType="application/octet-stream")]
private var serifNormalCls : Class;
private var normalFont : Font;
var bfNormal : BaseFont;
//...
//in youre initialization function :
FontsResourceFactory.getInstance().registerFont(SERIF_NORMAL, new this.serifNormalCls());
bfNormal = BaseFont.createFont(SERIF_NORMAL, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
//and when you need to use your the special characters, you will use that font
this.normalFont = new Font(Font.UNDEFINED, 10, Font.UNDEFINED, null, bfNormal);
Cheers!
Upvotes: 1