I am trying to convert PDF to PDFA-2B. And 1 of my test files contains Type1 fonts without a font descriptor:
I need to embed these fonts.
How can i embed these fonts?
I tried to create a font descriptor but I was not successful.
private static PdfDictionary addFontDesc(PdfDictionary font){
PdfDictionary fontDescriptor;
fontDescriptor = new PdfDictionary(PdfName.FONTDESCRIPTOR);
PRIndirectReference fd = fontDescriptor.getIndRef();
if (fd != null){
font.put(PdfName.FONTDESCRIPTOR, fd);
System.out.println("fontDescriptor was added to font " + font.getAsName(PdfName.BASEFONT).toString());
}else {
System.out.println("Error while trying to add fontDescriptor to " + font.getAsName(PdfName.BASEFONT).toString());
}
return font;
}
I always get a NullPointerException
.