In version v2019R1, we’ve added a public API in our Java PDF Library jPDFProcess to tell whether a font is embedded in a PDF document or not. This is done through a method called isEmbedded in the IFontResource interface, that returns a boolean.
The sample code below will get the list of all font resources in a PDF, loop through them and output the name of the fonts that are embedded in the PDF.
PDFDocument pdf = new PDFDocument("input.pdf", null); List<? extends IFontResource> fonts = pdf.getResourceManager().listFonts(); for(IFontResource res : fonts) { if(res.isEmbedded()) { System.out.println(res.getFontName() + " is embedded"); } } |