Embed font into PDF file by using iText

If you are doing more work with iText, you may want to invest into the iText book – it has examples for all the features of iText.

There is a parameter that you specify when you create your font that defines font embedding:

BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
Font font = new Font(helvetica, 12, Font.NORMAL);

You can find more iText font related examples here: http://1t3xt.info/examples/browse/?page=toc&id=14

Leave a Comment