Hi Nairo,

I've had similar problems, try using font encoding CP1250 and make sure your
encoding is set to ISO-8859-1 for your Java string, this may help on unix
work stations.

- Trevor

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Nairo
Granados Martinez
Sent: Wednesday, November 12, 2003 8:49 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [iText-questions] Problem Using CP1252 on linux


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 (a, i, m, s, s, Q, q, 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. Q -> \u00D1

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("Q","\u00D1");
        strSalida = strSalida.replaceAll("q","\u00F1");
        strSalida = strSalida.replaceAll("a","\u00E1");
        strSalida = strSalida.replaceAll("i","\u00E9");
        strSalida = strSalida.replaceAll("m","\u00ED");
        strSalida = strSalida.replaceAll("s","\u00F3");
        strSalida = strSalida.replaceAll("z","\u00FA");
        strSalida = strSalida.replaceAll("A","\u00C1");
        strSalida = strSalida.replaceAll("I","\u00C9");
        strSalida = strSalida.replaceAll("M","\u00CD");
        strSalida = strSalida.replaceAll("S","\u00D3");
        strSalida = strSalida.replaceAll("Z","\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



-------------------------------------------------------
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