Example usage for com.itextpdf.kernel.font PdfFontFactory createFont

List of usage examples for com.itextpdf.kernel.font PdfFontFactory createFont

Introduction

In this page you can find the example usage for com.itextpdf.kernel.font PdfFontFactory createFont.

Prototype

public static PdfFont createFont(byte[] fontProgram, String encoding, boolean embedded, boolean cached)
        throws IOException 

Source Link

Document

Created a PdfFont instance by the bytes of the underlying font program.

Usage

From source file:org.reactome.server.tools.diagram.exporter.raster.itext.awt.DefaultFontMapper.java

License:Open Source License

public DefaultFontMapper() {
    byte[] bytes;
    try {/*from   ww  w  .j ava2s . c  o m*/
        bytes = IOUtils.toByteArray(Resources.class.getResourceAsStream("fonts/arial.ttf"));
        REGULAR = PdfFontFactory.createFont(bytes, PdfEncodings.UTF8, true, true);
        bytes = IOUtils.toByteArray(Resources.class.getResourceAsStream("fonts/arialbd.ttf"));
        BOLD = PdfFontFactory.createFont(bytes, PdfEncodings.UTF8, true, true);
    } catch (IOException e) {
        e.printStackTrace();
    }

}