How to embed Helvetica font in PDF using iText?
Following does not work:
BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA,
BaseFont.CP1252, BaseFont.EMBEDDED);
Font font = new Font(helvetica, 20, Font.BOLD);
That is, this will return false:
font.getBaseFont().isEmbedded()
Embedding works if I provide the TrueType file myself as a parameter to createFont() method.
Yes, embedding of defined fonts will not work.
It cannot work.
iText, in order to embed font, must have the access to font resource. The defined fonts are provided by PDF reader and therefore are not available to your library during PDF creating process.
What is more, each PDF reader must provide this fonts, but have freedom of choice of licencing method for this fonts. Their licence can forbid any usage for final usage except the displaying of PDF files in that reader.