Message Boards
Adding fonts for IText
Daniel G, modified 3 Years ago.
Adding fonts for IText
Regular Member Posts: 141 Join Date: 3/14/17 Recent PostsHi,
I am trying to add Trebuchet MS font for using it with Itext for creating pdfs. I've pasted the ttf file in resources/ttf/ but I am not able to make it work. Anyone can give me any idea of how to do it?
I've tried so many ways but I can't make it work
Thanjs in advance
Regards
Daniel G, modified 3 Years ago.
RE: Adding fonts for IText
Regular Member Posts: 141 Join Date: 3/14/17 Recent PostsHi,
Finally I got it, I pasted the way for anyone who need it
String path = "/META-INF/resources/ttf/TrebuchetMS.ttf";
BaseFont baseFont = BaseFont.createFont(path, BaseFont.IDENTITY_H,true);
Font trebuchetFont = new Font(baseFont);
Regards