How to handle charsets in the PdfWriter / Reader ?

I am having problems with special characters..

code:

        public String export(String filename, Map<String, String> fields)
                        throws Exception {
                InputStream templateStream = getClass().getClassLoader()
                                .getResourceAsStream(templateFilename);
                PdfReader templateReader = new PdfReader(templateStream);
                ByteArrayOutputStream s = new 
ByteArrayOutputStream(templateReader
                                .getFileLength());
                PdfStamper stamper = new PdfStamper(templateReader, s);
                AcroFields l_acrofields = stamper.getAcroFields();

                if (fields != null) {
                        for (Map.Entry<String, String> entry : 
fields.entrySet()) {
                                l_acrofields.setField(entry.getKey(), 
entry.getValue());
                        }
                }
                stamper.close();

                File generatedPdf = new File(filename);
                File parent = new File(generatedPdf.getParent());
                if (!parent.exists()) {
                        parent.mkdir();
                        generatedPdf.createNewFile();
                }

                byte[] b = s.toByteArray();
                ByteArrayInputStream bi = new ByteArrayInputStream(b);
                sign(bi, generatedPdf);  // apply digital signature...
                return generatedPdf.getAbsolutePath();
        }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to