java - WARNING: Using fallback font 'Arial-BoldMT' for 'AccordAltBold' despite embedded and system fonts -


i've got single page pdf form uses custom fonts (made libreoffice). final output file use template multiple times. each form control within page has custom font set it's font type. pdf file has fonts embedded. here're file properties according foxit. copied file system without fonts installed , filled in reader dc , fonts show correctly. additionally, fonts installed on system well. here's relevant code fill form fields.

try(pddocument finaldoc = new pddocument())     {         template = new file(templatepath);         list<pdfield> fields = new arraylist<pdfield>();           system.out.println("pages build: " + results.size());         for(i = 0; < results.size(); i++)         {             system.out.println("building page: " + (i+1));             singleresult = results.get(i);             pddocument doc = pddocument.load(template);             pddocumentcatalog documentcatalog = doc.getdocumentcatalog();             pdacroform acroform = documentcatalog.getacroform();             //acroform.setneedappearances(false); //#first option              pdfield field = acroform.getfield("txtusername");             field.setvalue(nameandnumber.get(0));             field.setpartialname("txtusername" + i);             fields.add(field);              field = acroform.getfield("txtphonenumber");             field.setvalue(nameandnumber.get(1));             field.setpartialname("txtphonenumber" + i);             fields.add(field);              finaldoc.addpage(doc.getpage(0));         }          pdacroform finalform = new pdacroform(finaldoc);         //finalform.setneedappearances(false); //#second option         finaldoc.getdocumentcatalog().setacroform(finalform);         finalform.setfields(fields);         finalform.flatten(fields, true); //#third option          finaldoc.save(new file("outputpdf.pdf"));     }catch(exception e)     {         //do stuff     } 

now, if either options 1,2 or 3 (as marked above) commented out, no visible text in outputpdf.pdf file. if either of 3 uncommented, visible text, it's in arial following warnings

jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arialmt' 'accordaltmedium' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arialmt' 'accordaltmedium' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arial-boldmt' 'accordaltbold' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arial-boldmt' 'accordaltbold' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arial-boldmt' 'accordaltbold' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arial-boldmt' 'accordaltbold' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arialmt' 'accordaltregular' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arialmt' 'accordaltregular' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arial-boldmt' 'accordaltbold' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arial-boldmt' 'accordaltbold' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arial-boldmt' 'accordaltbold' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arialmt' 'accordaltregular' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arialmt' 'accordaltregular' jul 21, 2016 8:29:29 pm org.apache.pdfbox.pdmodel.font.pdtruetypefont <init> warning: using fallback font 'arial-boldmt' 'accordaltbold' 

i'm not entirely sure @ point what's causing problem. closest can guess when try read fonts embedded in template using code:

pddocument doctemp = pddocument.load(new file(templatepath));         pdpage page = doctemp.getpage(0);         iterable<cosname> pagefonts=page.getresources().getfontnames();         for(cosname c:pagefonts)         {             system.out.println(c.getname());         } 

i see list output:

font:f1 font:f2 font:f3 font:he 

i'm guessing means pdfbox isn't recognizing fonts document correct ones, i'm not sure why is. i'm using pdfbox 2.0.2, i've tried 2.0.1 well. libreoffice writer version 5.1.4.2

can please me? i've spent entire workday on , i'm @ wits end. i've tried exporting pdf , fdf made no difference.

link pdf i'm not sure why file isn't larger, singe each of 3 fonts 30kb each, don't know enough pdf standard sure of anything. link odt (large because fonts embedded.)


Comments