java - itext transfers my letters to html letter codes -
i have pdf in user copies text desktop , on submit pdf generated. use itext-2.1.7. since use non standard letter these converted html code character codes. servlet doc use "application/pdf;charset=utf-8".
basefont bf; try { httpsession session = request.getsession(true); if (session.getattribute("taxnumber") == null || session.getattribute("email") == null || session.getattribute("password") == null) { request.setattribute("message", "the user not exist in our database"); request.getrequestdispatcher("/login.jsp").forward(request, response); } string title = request.getparameter("doctitle"); string date = request.getparameter("docdate"); string text = request.getparameter("brokerstext"); string[] newdate = date.split("/"); document document = new document(pagesize.a4); pdfwriter writer = pdfwriter.getinstance(document, response.getoutputstream()); document.open(); document.add(new paragraph(newdate[1] + "/" + newdate[0] + "/" + newdate[2])); document.add(new paragraph(title)); document.add(new paragraph(text)); document.add(chunk.newline); document.add(chunk.newline); document.add(chunk.newline); document.add(new lineseparator()); document.add(chunk.newline); document.add(new lineseparator()); document.add(chunk.newline); document.add(chunk.newline); document.add(new paragraph("brokers's digital signature clients's digital signature")); pdfformfield field1 = pdfformfield.createsignature(writer); field1.setwidget(new rectangle(72, 100, 172, 200), pdfannotation.highlight_invert); field1.setfieldname("mysig1"); field1.settitle("klijent1"); field1.setflags(pdfannotation.flags_print); field1.setpage(); pdfappearance tp1 = pdfappearance.createappearance(writer, 72, 48); tp1.rectangle(0.5f, 0.5f, 71.5f, 47.5f); tp1.stroke(); field1.setappearance(pdfannotation.appearance_normal, tp1); writer.addannotation(field1); pdfformfield field2 = pdfformfield.createsignature(writer); field2.setwidget(new rectangle(372, 100, 472, 200), pdfannotation.highlight_invert); field2.setfieldname("mysig2"); field2.settitle("klijent2"); field2.setflags(pdfannotation.flags_print); field2.setpage(); pdfappearance tp2 = pdfappearance.createappearance(writer, 72, 48); tp2.rectangle(0.5f, 0.5f, 71.5f, 47.5f); tp2.stroke(); field2.setappearance(pdfannotation.appearance_normal, tp2); writer.addannotation(field2); document.close();
i did use
public static final string font = "c:/windows/fonts/segoeui.ttf"; bf = basefont.createfont(font, basefont.identity_h, basefont.embedded); document.add(new paragraph(title,new font(bf, 12)));
buy putting in other fonts did not text looks "o deponovanim novĨanim" transfers "o deponovanim nov&#....." , stackoverflow displays same . in pdf html code of letters . how display right .
please write values of title
, text
log file plain text. there's 99.9% chance contain same html codes. if do, don't have itext-related problem. instead have servlet problem ;-)
Comments
Post a Comment