3 Replies Latest reply on Nov 14, 2007 7:18 AM by roohi moosavi

    problem with unicodes in itext

    roohi moosavi Newbie

      i use itext2.0.1 and seam 1.2.1
      when i try to generate a pdf with unicode characters (farsi or arabic) seam dont generate these characters.
      when a document contains both farsi and english characters, seam only generate a pdf with english characters
      what i do ?

        • 1. Re: problem with unicodes in itext
          Farshid Zaker Newbie

          I have the same problem.
          According to "itext in action", for using arabic language in pdf,

          Arabic glyphs are written as double byte chars.
          Your encoding should be BaseFont.IDENTITY_H, and you should be using a unicode font.

          How should we do these in seam pdf?

          • 2. Re: problem with unicodes in itext
            Ricardo Memoria Novice


            I have this same problem, but with Romanian language, that already has chars like ? and ? that are not displayed in the PDF.

            Any solution for that?


            • 3. Re: problem with unicodes in itext
              roohi moosavi Newbie

              you must manipulate UIFont class locatet in org.jboss.seam.pdf.ui;

              private BaseFont getFont(String familyName) {
               try {
               return BaseFont.createFont("c:/windows/fonts/" + familyName + ".ttf",
               BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
               } catch (Exception e) {
               try {
               return BaseFont.createFont("d:/windows/fonts/" + familyName + ".ttf",
               BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
               } catch (Exception e1) {
               return null;
               public void createITextObject(FacesContext context) {
               familyName = (String) getAttributes().get("familyName");
               if (familyName == null || familyName.equals(""))
               familyName = "nazanin";
               //int family = (familyName==null) ? Font.UNDEFINED : Font.getFamilyIndex(familyName);
               size = (Integer) valueBinding(context, "size", size);
               font = new Font(getFont(familyName), size);
               style = (String) valueBinding(context, "style", style);
               if (style != null) {