Build Status

Java library for converting and manipulating various font formats, normalizing invalid fonts and extracting fonts from PDFs.

Currently supports

With PdfFontExctractor utility

Can only convert these types with PdfFontExtractor utility

Maven (On Maven Central)


Optional jBrotli dependency for WOFF2 support. jBrotli is currently optional since it is not on Maven Central or JCenter yet.




Converting a font (in this case to OTF)
FVFont font = FontVerter.convertFont(inputFontFile, FontVerter.FontFormat.OTF);
FileUtils.writeByteArrayToFile(new File("MyFont.otf"), font.getData());
Reading a font file
File file = new File("FontVerter+SimpleTestFont.otf");
FVFont font = FontVerter.readFont(file);
Attempt to normalize and fix an invalid font
File file = new File("FontVerter+SimpleTestFont.otf");
FVFont font = FontVerter.readFont(file);

if (!font.isValid())

FileUtils.writeByteArrayToFile(new File("fixed-font.otf"), font.getData());
PDF Font Extractor command line
PdfFontExtractor <PDF file or directory containing PDF files>

-ff=<format> Font format to save the fonts as. <format> = WOFF1, WOFF2, OTF. Defaults to OTF.
-dir=<path> Directory to extract to. <path> = font extract directory. Defaults to {current dir}/fonts/
PDF font extractor programatically
File pdf = new File("test.pdf");
PdfFontExtractor extractor = new PdfFontExtractor();

// extract directly to a directory
extractor.extractFontsToDir(pdf, TestUtils.tempOutputPath);

// or extract to list of FVFonts for further manipulation
List<FVFont> fonts = extractor.extractToFVFonts(doc);