Load and Extract Data | Java

Contents
[ Hide Show ]

The examples use courier.pfb. Adapt getDataDir() and the relative input path in the snippets to your font location.

Load Type1 Font from Disc

Aspose.Font for Java API lets you read Type1 Font types from files stored in your digital storage. Type1 font files stored on disc can be loaded by using the following steps.

1String fileName = Paths.get(getDataDir(), "..", "Type1", "courier.pfb").normalize().toString();
2FontDefinition fd = new FontDefinition(FontType.Type1,
3        new FontFileDefinition("pfb", new FileSystemStreamSource(fileName)));
4Type1Font font = (Type1Font) Font.open(fd);