Hi All,

I'm developing and Application on Linux, and this
application makes PDF files taking the information
from the database.

Everything works OK but I Have a proble with the Latin
Characters (�, �, �, �, �, �, �, etc).

When I take the info from the database and printed to
teh PDF this special characters become a blank space.

after that I write a function that convert this
charactes to CP1252 writing codes. e.g. � -> \u00D1

But now, it appears a question mark (?) instead of teh
special character

This are the functions:

        public static Paragraph setFormatearTextoPDF(String
strTexto, String strTipoLetra, boolean blnNegrita,
boolean blnCursiva, int intSize, Color clColorLetra,
String strAlineacion) throws java.io.IOException,
DocumentException, ClassNotFoundException 
        {
                        Font ftLetra = null;
                        BaseFont bfTipoLetra =
BaseFont.createFont(strTipoLetra, BaseFont.CP1252,
BaseFont.NOT_EMBEDDED);
                        
                        if (blnNegrita && blnCursiva) { ftLetra = new
Font(bfTipoLetra, intSize, Font.BOLDITALIC,
clColorLetra); }
                        else if (blnNegrita) { ftLetra = new
Font(bfTipoLetra, intSize, Font.BOLD, clColorLetra); }
                        else if (blnCursiva) { ftLetra = new
Font(bfTipoLetra, intSize, Font.ITALIC, clColorLetra);
}
                        else { ftLetra = new Font(bfTipoLetra, intSize,
Font.NORMAL, clColorLetra); }

                    strTexto = StrToCP1252(strTexto);
                    Paragraph paLetra = new Paragraph(strTexto,
ftLetra);
                    paLetra.setAlignment(strAlineacion);

                        return paLetra;
        }

    public static String StrToCP1252(String
strEntrada)
        {
        String strSalida = strEntrada;
        strSalida = strSalida.replaceAll("�","\u00D1");
        strSalida = strSalida.replaceAll("�","\u00F1");
        strSalida = strSalida.replaceAll("�","\u00E1");
        strSalida = strSalida.replaceAll("�","\u00E9");
        strSalida = strSalida.replaceAll("�","\u00ED");
        strSalida = strSalida.replaceAll("�","\u00F3");
        strSalida = strSalida.replaceAll("�","\u00FA");
        strSalida = strSalida.replaceAll("�","\u00C1");
        strSalida = strSalida.replaceAll("�","\u00C9");
        strSalida = strSalida.replaceAll("�","\u00CD");
        strSalida = strSalida.replaceAll("�","\u00D3");
        strSalida = strSalida.replaceAll("�","\u00DA");
        return strSalida;
    }

Any idea how could I solve this?

Thanks a lot,

Nairo Granados


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to