List of usage examples for org.apache.pdfbox.pdmodel.font FontFormat OTF
FontFormat OTF
To view the source code for org.apache.pdfbox.pdmodel.font FontFormat OTF.
Click Source Link
From source file:org.mabb.fontverter.converter.PsType0ToOpenTypeConverter.java
License:Open Source License
private OpenTypeFont buildFromCff() throws IOException { byte[] cffData = type0Font.getFontDescriptor().getFontFile3().toByteArray(); OpenTypeFont otfFont = (OpenTypeFont) FontVerter.convertFont(cffData, FontVerter.FontFormat.OTF); return otfFont; }
From source file:org.mabb.fontverter.pdf.PdfFontExtractor.java
License:Open Source License
public static void main(String[] args) throws IOException { if (args.length < 1 || Arrays.asList(HELP_CODES).contains(args[0])) { System.out.println("Usage: PdfFontExtractor <pdf file or directory containing pdf files>"); System.out.println("Options: "); System.out.println(// w w w . j av a2s.co m "-ff=<format> Font format to save the fonts as. <format> = WOFF1, WOFF2, OTF. Defaults to OTF."); System.out.println( "-dir=<path> Directory to extract to. <path> = font extract directory. Defaults to {current dir}/fonts/"); System.exit(1); } String extractPath = DEFAULT_EXTRACT_PATH; FontFormat format = FontFormat.OTF; for (String argOn : args) { String value = argOn.replaceAll("-[^=]*=", ""); if (argOn.startsWith("-ff=")) format = FontFormat.fromString(value); else if (argOn.startsWith("-dir=")) extractPath = value; } File pdf = new File(args[0]); if (pdf.isDirectory()) { List<File> pdfFiles = (List<File>) FileUtils.listFiles(pdf, new String[] { "pdf" }, true); for (File fileOn : pdfFiles) try { extractPdfFonts(extractPath, fileOn, format); } catch (Throwable ex) { ex.printStackTrace(); } } else extractPdfFonts(extractPath, pdf, format); }