Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Adding fonts for IText
Hi,
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
Hi,
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
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™