I'm trying to create pdf files in my android application using www.itextpdf.com , but i'm confused to using font from my assets
Problem 1
1- using my .TTF font that stored in my application assets , i always used TypeFace but now itext want me a "Font variable"
the syntax is like this :
Font font = FontFactory.getFont("c:/windows/fonts/arial.ttf", BaseFont.IDENTITY_H, 18);
but it's no C:/ in android !
Problem 2
when i add a UTF-8 paragraph like Arabic or Persian , itext add nothing in PDF file
I was having the exact same issue, but I found the answer in another post that can be found HERE.
Pretty much, what you are going to want to do is something similar to this:
BaseFont urName = BaseFont.createFont("assets/subFolder/fontName.TTF", "UTF-8",BaseFont.EMBEDDED);
Font urFontName = new Font(urName, 12);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With