5 Replies Latest reply on Feb 8, 2011 3:47 AM by blabno

    UTF8 content in the iText generated PDF

    zeppelinux.dmitry.diligesoft.com

      I have a document template with some dynamic string values.
      When these values are in plain english they are rendered in the generated pdf properly, but when it is not - they are totally missing.


      Does it needs any special configuration for UTF8 support?

        • 1. Re: UTF8 content in the iText generated PDF
          idyoshin

          Hello Dmitry,


          we've reached also a great number of problems while we've been trying to include UTF-8. Amazingly for our application (which has lots of russian output in the pdf) - we've switched to CP1251 and every problem gone!..


          So, If you need some fast results - simply change your encoding to something windows-related,


          Hope there would be a better support of UTF-8 in the future releases.



          Regards,


          Ilya Dyoshin

          • 2. Re: UTF8 content in the iText generated PDF
            zeppelinux.dmitry.diligesoft.com

            Privet Ilya,


            My application is related to Immigration, so it needs to deal with many different languages.
            If there is no way to handle it properly - some serious limitations must be applied...



            Hope somebody is using iText with Seam for multilanguage rendering.



            Cheers,


            Dmitry.

            • 3. Re: UTF8 content in the iText generated PDF
              fillo

              Hi,


              I have the same problem.
              I need to use a dynamic codepage and I'm not able to make it works.


              I've tried:
                 


                  <p:font color="red" encoding="#{config.codepage}">
                      <p:text value="#{article.description}" />
                  </p:font>
              



              But it doesn't work, it seems that codepage must be set up like this:


                  <p:font color="red" encoding="CP1256">
                      <p:text value="#{article.description}" />
                  </p:font>
              



              As Dmitry said, it seems to be a serious limitation if is not possible create multilingual documents. Of course a solution could be to have one template per language, but IMHO create 20 identical files and only change one parameter, it's hard to believe for me nowadays.


              There is no other option to configure Seam PDF, any page parameter, document encoding?




              • 4. Re: UTF8 content in the iText generated PDF
                enda

                Howdy,


                here is the trick for Unicode :)


                Get font and put it in your project :)


                <p:font name="/resources/arialuni.ttf" 
                            encoding="Identity-H" 
                            embedded="true">
                           +ěščřžýáíé+ĚŠČŘŽÝÁÍ
                 </p:font> 



                • 5. Re: UTF8 content in the iText generated PDF
                  blabno

                  Tomas, thanks a lot!!


                  But the font shouldn't go into the project but into the filesystem and the font name here in the code is filesystem path, not anything related to context path.