Dear Mr. Soares,

 

Thanks a lot for your help. I got the desired output with Japanese characters displayed in the PDF.

As if now, the pdf looks fine, aligned as desired but if I give print from  the  generated PDF , the printout is a bit Right aligned, means its not getting printed at the middle of the Page, in  the Pdf ,the graphics is correctly aligned, so it is in  the  Print Preview of Adobe.

I wonder whether its is a problem from the Adobe, or is it my code which is generating such printouts.

 

Please suggest

 

Best Regards

Rajarshi      



Paulo Soares <[EMAIL PROTECTED]> wrote:
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


Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.

Reply via email to