See
http://article.gmane.org/gmane.comp.java.lib.itext.general/7102


--- rajarshi biswas <[EMAIL PROTECTED]> wrote:

> Hi !
>  
> I  am currently working with iText 1.1/iTextAsian to
> generate PDF for a Tree drawn in Java Swing.
> I m facing problem in displaying Japanese Text in
> the Pdf.I have used iTextAsian for displaying CJK
> fonts , but its generating the PDF with no Japanese
> text,infact it comes as blank, english text is
> displaying fine
>  
> The code look like this :
> 
> PdfWriter writer = PdfWriter.getInstance(document,
> new FileOutputStream(fileName));            
> 
> document.open();
> 
> BaseFont bf =
> BaseFont.createFont("HeiseiMin-W3","UniJIS-UCS2-H",
> BaseFont.NOT_EMBEDDED);
> 
> com.lowagie.text.Font font = new
> com.lowagie.text.Font(bf, 11,
> com.lowagie.text.Font.NORMAL);                      
>                                       
> DefaultFontMapper mapper = new DefaultFontMapper(); 
>                                                     
>  Font foo=mapper.pdfToAwt(bf,10);
> 
> cb = writer.getDirectContent();                     
>                                                     
>  cb.saveState();                                    
>                                                     
>      cb.concatCTM(1, 0, 0, 1, 0, 0);                
>                                                     
>        Graphics2D g2 = cb.createGraphics(1000,700);
> 
> drawBody(g2,foo);                                   
>                                                     
>            g2.dispose();
> And the method look like this:
>  
>  private void drawBody(Graphics2D g,foo) {
>  
>   g.setFont(foo);
>  
>
g.drawString(((String)header.elementAt(0)).replaceAll(":","").trim(),391,28);
>   String s =
>
((String)header.elementAt(1)).replaceAll(":","").trim();
>   g.drawString(s,391,40);
>   s =
>
((String)header.elementAt(2)).replaceAll(":","").trim();
>   g.drawString(s,427,28);
>   s =
>
((String)header.elementAt(3)).replaceAll(":","").trim();
>   g.drawString(s,427,40);
>   s =
>
((String)header.elementAt(4)).replaceAll(":","").trim();
>   g.drawString(s,475,28);
>   s =
>
((String)header.elementAt(7)).replaceAll(":","").trim();
>   g.drawString(s,475,40);
>   s =
>
((String)header.elementAt(8)).replaceAll(":","").trim();
>   g.drawString(s,529,28);
>   s =
>
((String)header.elementAt(9)).replaceAll(":","").trim();
>   g.drawString(s,529,40);
>   s =
>
((String)header.elementAt(10)).replaceAll(":","").trim();
>   g.drawString(s,583,28);
>   s =
>
((String)header.elementAt(11)).replaceAll(":","").trim();
>   g.drawString(s,583,40);
> }
>  
> In this case it is not displaying the  Japanese
> text. Please suggest how can i get rid of the
> situation.
>  
> Best Regards
> Rajarshi.
>  
> 
>               
> ---------------------------------
> Do you Yahoo!?
>  Yahoo! Mail - Helps protect you from nasty viruses.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to