java - pdfBox 2.0.7 Arabic issue -
hi using pdfbox create pdf file writing characters in english , others in arabic when arabic disconnected , reversed . ف ر ح , error message jul 25, 2017 1:51:20 pm org.apache.pdfbox.pdmodel.font.pdcidfonttype2 warning: using fallback font liberationsans cid-keyed truetype font nazaninltlight jul 25, 2017 1:51:20 pm org.apache.pdfbox.pdmodel.font.pdtype0font tounicode warning: no unicode mapping cid+3 (3) in font nazaninltlight
public class pdfcreator { public static void main(string[] args) throws ioexception { pddocument document = new pddocument(); pdpage page = new pdpage(); document.addpage(page); file myfile = new file("/home/charefdz19/desktop/nazaninltlight.ttf"); pdfont font = pdtype0font.load(document, myfile); pdpagecontentstream contentstream = new pdpagecontentstream(document, page); contentstream.begintext(); contentstream.setfont(font, 12); contentstream.newlineatoffset(30, 40); string arabictext = " حرف" ; system.setproperty("ste.encoding", "utf-8"); contentstream.showtext(arabictext); contentstream.endtext(); contentstream.close(); pdftextstripper textstripper = new pdftextstripper(); string text = textstripper.gettext(document); system.out.print(text); document.save("test.pdf"); }
}
Comments
Post a Comment