Hello everyone; I'm trying to set the encoding in a PDF.
The encoding project is in UTF-8, because the database has that encoding. But when i generate the document, i add paragraphs with others characters, like Ñ, ñ, á, é, í, ó, ú, °. So, to keep the encoding, i made this function: public static String stringFormatoUTF8(String stringIN) { try { if (stringIN.length() == 0) { stringIN = " "; }byte[] arrayAux = stringIN.getBytes("ISO-8859-1");
String stringOUT = new String(arrayAux, "UTF-8"); return stringOUT; } catch(IOException error) { System.err.println(error.getMessage()); return ""; } } And i call it in this way: cell = new PdfPCell(new Paragraph( Fmt.stringFormatoUTF8("N° Operación:"), font12B )); But, for each paragraph that i add in the document, i must call the function. Is there a way to set the document encoding?, like, for example, document.setEncoding("UTF-8"); I'm using iText 5.3.3 Hope you understand me. Thank you!
------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php