IText Printing Probelm in unicode stiring

hello !!
Pls try to solve my problem...
i have wirte the following code ..
it will generate pdf and write text in that pdf file using two different methods for the same input text...just try to run and see output..
pls prove me the solution to priont the same result...
code is..
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
import java.io.FileOutputStream;
public class GujaratiPDF
public static void main( String[] args )
try
// step 1
Document document = new Document( PageSize.A4, 50, 50, 50, 50 );
// step 2
PdfWriter writer = PdfWriter.getInstance(
document,
new FileOutputStream( "gujarati.pdf" ) );
writer.setPdfVersion( PdfWriter.VERSION_1_6 );
// step 3
document.open( );
// step 4
// NOTE: change the font file path if different on your PC
BaseFont bf_arial = BaseFont.createFont( "C:/WINDOWS/Fonts/arialuni.ttf",
BaseFont.IDENTITY_H, BaseFont.EMBEDDED );
String text = "\u0A9C\u0AA8\u0ACD\u0AAE\u0AA6\u0AC0\u0AA8\u0AA8\u0AC0\u0020\u0AB6\u0AC1\u0AAD\u0AC7\u0A9A\u0ACD\u0A9B\u0ABE";
String arial_font = " [Font: Arial Unicode MS";
      String add_method = ", Method: document.add(...)]";
String drawString_method = ", Method: graphics.drawString(...)]";
// step 5
document.add(
new Paragraph(
text + arial_font + add_method,
new Font( bf_arial ) ) );
// write using the Graphics object
java.awt.Font font = new java.awt.Font( "arial unicode ms", 0, 11 );
PdfContentByte cb = writer.getDirectContent( );
java.awt.Graphics2D g2 = cb.createGraphicsShapes(
PageSize.A4.width( ),
PageSize.A4.height( ) );
g2.setFont( font );
g2.drawString( text + arial_font + drawString_method, 50, 200 );
g2.dispose( );
// step 6
document.close( );
catch( Exception de )
de.printStackTrace( );
}

hello !!
Pls try to solve my problem...
i have wirte the following code ..
it will generate pdf and write text in that pdf file using two different methods for the same input text...just try to run and see output..
pls prove me the solution to priont the same result...
code is..
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
import java.io.FileOutputStream;
public class GujaratiPDF
public static void main( String[] args )
try
// step 1
Document document = new Document( PageSize.A4, 50, 50, 50, 50 );
// step 2
PdfWriter writer = PdfWriter.getInstance(
document,
new FileOutputStream( "gujarati.pdf" ) );
writer.setPdfVersion( PdfWriter.VERSION_1_6 );
// step 3
document.open( );
// step 4
// NOTE: change the font file path if different on your PC
BaseFont bf_arial = BaseFont.createFont( "C:/WINDOWS/Fonts/arialuni.ttf",
BaseFont.IDENTITY_H, BaseFont.EMBEDDED );
String text = "\u0A9C\u0AA8\u0ACD\u0AAE\u0AA6\u0AC0\u0AA8\u0AA8\u0AC0\u0020\u0AB6\u0AC1\u0AAD\u0AC7\u0A9A\u0ACD\u0A9B\u0ABE";
String arial_font = " [Font: Arial Unicode MS";
      String add_method = ", Method: document.add(...)]";
String drawString_method = ", Method: graphics.drawString(...)]";
// step 5
document.add(
new Paragraph(
text + arial_font + add_method,
new Font( bf_arial ) ) );
// write using the Graphics object
java.awt.Font font = new java.awt.Font( "arial unicode ms", 0, 11 );
PdfContentByte cb = writer.getDirectContent( );
java.awt.Graphics2D g2 = cb.createGraphicsShapes(
PageSize.A4.width( ),
PageSize.A4.height( ) );
g2.setFont( font );
g2.drawString( text + arial_font + drawString_method, 50, 200 );
g2.dispose( );
// step 6
document.close( );
catch( Exception de )
de.printStackTrace( );
}

Similar Messages

  • Smartform Printing Probelm

    Dear Experts,
    I faced a probelm while i am trying to take print the smartform. It's shows Graphic is not displayed message shows.
    what is the probelm please guide me.
    Thanks in Advance
    purnaneelu

    check there is no mismatch in black n white and color..
    may be this is the possiblity. that u uploaded graphiv in B&W andusing colour.
    had u check window size problem ?

  • Printing Polish from Unicode ECC system

    Hi,
    to print Polish characters as SAPscript, ABAP-list or SmartForms from a ECC 6.0 already converted in Unicode, is it right way cascading fonts, SAPWIN, SAPSprint, ecc. ?
    Or... can I use "classic" HPLJ4000 device type with access method D?
    My ECC system:
    SAP_ABA     700     0014
    SAP_BASIS     700     0014
    PI_BASIS     2006_1_700     0004
    ST-PI     2008_1_700     0001
    SAP_BW     700     0016
    SAP_AP     700     0012
    SAP_APPL     600     0012
    SAP_HR     600     0022
    EA-IPPE     400     0011
    EA-APPL     600     0011
    EA-DFPS     600     0011
    EA-FINSERV     600     0011
    EA-GLTRADE     600     0011
    EA-HR     600     0022
    EA-PS     600     0011
    EA-RETAIL     600     0011
    FINBASIS     600     0011
    ECC-DIMP     600     0011
    ERECRUIT     600     0011
    FI-CA     600     0011
    FI-CAX     600     0011
    INSURANCE     600     0011
    IS-CWM     600     0011
    IS-H     600     0012
    IS-M     600     0011
    IS-OIL     600     0011
    IS-PS-CA     600     0011
    IS-UT     600     0011
    LSOFE     600     0011
    SEM-BW     600     0011
    ST-A/PI     01L_ECC600     0000
    Kernel Patch number : 227
    Thank you.
    Regards.

    Hi,
    you can use
    1) standard device type I2HP4 (for polish only - does not work, if you e.g. have mixed data e.g. from Western and Eastern europe)
    2) standard device type I2SWIN (for polish only - does not work, if you e.g. have mixed data e.g. from Western and Eastern europe)
    3) HPUTF8 or LEXUTF8 (you will need specific Unicode capable printers for these device types)
    4) Cascading Fonts as outlined in SAP note 812821 (mainly if you want to print data from multiple old code pages)
    5) Check SAP note 1097990 for your printer vendor - whether Eastern European data is supported.
    Usually, point 1. and / or  2. is the easiest way to print latin-2 data.
    Best regards,
    Nils Buerckel
    SAP AG

  • Print probelm in po

    when i use po message print,the function below,
    call function 'ME_READ_PO_FOR_PRINTING'
           exporting
                ix_nast        = nast
                ix_screen      = ent_screen
           importing
                ex_retco       = ent_retco
                ex_nast        = l_nast
                doc            = l_doc
           changing
                cx_druvo       = l_druvo
                cx_from_memory = l_from_memory.
    data:ekko like ekko.
           ekko = l_doc-xekko.
    but i cann't extract data like this:w_ebeln = ekko-ebeln,
    there is a error:the data object "ekko" has no structure therefore no component called "ebeln".
    would anybody tell me how can i do?

    At the top mention :
    Tables : EKKO.
    Best regards,
    Prashant

  • Printing Probelm

    Hi,
        We have developed a smartform for Voucher document printing. In print preview displaying line items only 1 time. When taking print its coming every line items  2 times. Whats the problem for that. Kindly suggest .

    when printing it directly without previous print preview, do your line items come 2 times as well?
    If not, you got a clear problem.

  • DMS - printing probelm

    DEar All,
    I am working in the PPPI industyr and we are having DMS in our company.
    We have a document type i.e BPR which we upload at CV01n transaction in MS documnet format that document under goes through 3 approval process after finaly apprval i.e QM release" we can assigne that Document in the recipe as a PRT .
    We have one Z transaction with help of that Aurhtorised user can able to take the print. BUt now a days we are facing problem ralated to printing of the MS document-
    1. some times page number are not printed correctly on the document.
    2. Some times out 40 pages only four page got printed.
    3. As we upload the documnet of 40 pages after printing it could be 60.
    We are fade up these issue .....please reply .
    Regards,
    PRERNA

    Hi PRERNA,
    does this only happen in combination with your Z transaction or also in the DMS standard transaction CV02N or CV03N if you print the attached original files?
    Best regards,
    Christoph

  • PO Printing Probelm

    Hi All,
    I am facing promble with mexxn Transaction code. When I generate a PO and try to print preniew but stop message appear "Company Code is not Defined". I had checked all tax code and its company and calculation schema. but cant find the solution. This message is even generate in me9f and me23n too.
    Regards,
    Syed Tayab Shah

    Thanks Raja for your reply. I had compare ox18 company assignment with QAS server and modified it as define in QAS. but message is still appear. Exact message is :.
    output    output
    company code is not defined
    STOP
    EXIT
    |     |                                                                    |                                           |
    Hope you understant the error.
    Syed Tayab Shah

  • Outlook live msn email print probelm

    until 2 days ago everything was fine
    automatic updates on my computer, so no clue which update created problem
    when I attempt to print an email the log in screen for live.com shows up and says it cannot connect right now

    Hello northshorecap,
    Please explain a bit about the following question for better analyzation:
    1. What are the Windows and Internet Explorer Editions?
    2. Could you please provide the whole error message and a screenshot to avoid misunderstanding?
    3. Please list the update you installed 2 days ago for better analyzation.
    Please take the following steps for troubleshooting:
    1. Check if you can printer other email or doc file.
    2. Run the printer troubleshooter.
    For more information, please refer to the following article.
    http://windows.microsoft.com/en-us/windows/printer-problems-in-windows-help#fix-printer-problems=windows-8&v1h=win8tab1&v2h=win7tab1&v3h=winvistatab1&v4h=winxptab1
    Best regards,
    Fangzhou CHEN
    Fangzhou CHEN
    TechNet Community Support

  • How to print unicode in SAPscript

    hi gurus,
    I am now having a problem in printing uinicode in printing ( printer HP LaserJet 4250 PCL 6) with SAPscript. Although i have changed the font in SAPscript text ( paragraph format ) , but when i print out , the font does not change , coul you please help me this
    Thanks ,

    Let me tell you how to print double digit character in printer.
    Usually, all ENGLISH characters are single digit characters and they can be printed on ordinary printer.
    Now coming back to double digit character Japanese, chinese, Vitanamese, some special symbols etc. for printing this characters unicode enabled printer is must.
    Usually, you can ask your basis team to enable unicode to your printer, all they need is some additional hard disk, they will be setting your printer in SAP.
    Note: Until unless you enable unicode (HP LaserJet 4250 PCL 6) it acts as an ordinary printer.
    Reward points if useful.
    Regards,
    SaiRam

  • Convert UTF-8 (Unicode) Hex to Hex Byte Sequence while reading file

    Hi all,
    When java reads a utf-8 character, it does so in hex e.g \x12AB format. How can we read the utf-8 chaacter as a corresponding byte stream (e.g \x0905 is hex for some hindi character (an Indic language) and it's corresponding byte sequence is \xE0\x45\x96).
    can the method to read UTF-8 character byte sequence be used to read any other (other than Utf 8, say some proprietary font) character set's byte sequence?

    First, there's no such thing as a "UTF-8 character". UTF-8 is a character encoding that can be used to encode any character in the Unicode database.
    If you want to read the raw bytes, use an InputStream. If you want to read text that's encoded as UTF-8, wrap the InputStream in an InputStreamReader and specify UTF-8 as the encoding. If the text is in some other encoding, specify that instead of UTF-8 when you construct the InputStreamReader. import java.io.*;
    public class Test
      // DEVANAGARI LETTER A (अ) in UTF-8 encoding (U+0905)
      static final byte[] source = { (byte)0xE0, (byte)0xA4, (byte)0x85 };
      public static void main(String[] args) throws Exception
        // print raw bytes
        InputStream is = new ByteArrayInputStream(source);
        int read = -1;
        while ((read = is.read()) != -1)
          System.out.printf("0x%02X ", read);
        System.out.println();
        is.reset();
        // print character as Unicode escape
        Reader r = new InputStreamReader(is, "UTF-8");
        while ((read = r.read()) != -1)
          System.out.printf("\\u%04X ", read);
        System.out.println();
        r.close();
    } Does that answer your question?

  • Crystal reports printing in dot matrix printer

    I'm using Crystal Reports 2008 with Visual Basic.Net 2008. The problem is that when i print the report in a laser printer, everything is good, but when i used dot matrix printer (like Epson LX 300+), reports is printed smaller than original, doesn't matter if i see good in preview. This is an Asp.Net web form.
    How can i fix this problem

    1) Make sure you have the latest CR Service Pack:
    SP4 https://smpdl.sap-ag.de/~sapidp/012002523100008782452011E/cr2008sp4.exe
    SP4 MSI https://smpdl.sap-ag.de/~sapidp/012002523100008782532011E/cr2008sp4_redist.zip
    SP4 MSM https://smpdl.sap-ag.de/~sapidp/012002523100008782522011E/cr2008sp4_mm.zip
    2) Make sure you have the latest updates for the printer driver
    3) Make sure the printer driver is Unicode compliant
    4) Experiment with the "No Printer" option and Dissociate Formatting Page Size and Printer Paper Size option
    5) Compare print from the CR designer to the app print. Do you see the same issue with both?
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Problem Displaying Unicode at the console

    Hello,
    What do I need to do to print out a unicode charecter which is of some other language for example ( telugu,an indian language).
    I had found out that the unicode range for telugu is 0C00 to 0C7F.
    I had tried doing char c = '\u0C10';
              System.out.println(c);
    But I could only see that a '?' symbol is being printed to the console.
    Could some one suggest an alternate or what is wrong with what I'm doing?
    Thanks in advance.

    I can install my local language font, but would it be
    helping things out?I told you, I have Japanese installed, and it didn't help me. Joni offered you a suggestion or two. Did you try them?
    because I think the unicode chraecter set relies on
    local OS! But I'm not sure.I don't know how much it depends on the OS, but it definitely depends on the capabilities of the program running. MS Word supports unicode, but that doesn't mean all Windows programs do.
    Why does'nt Windows XP Support Unicode at command
    prompt?Because cmd.exe is a very old program and probably the folks at M$ figured the way it's used it doesn't need to support unicode.
    Why do you need unicode in your command prompt?

  • Using GFI Faxmaker NetPrintQueue2Fax-printer doesn´t work with CR  XI

    A customer of us needs help urgently!
    Using NetPrintQueue2Fax with CR 8 generated reports worked fine, but after upgrade software to CR XI, no changes made in existing reports, we are not able to send faxes using NetPrintQueue2Fax-printer. The faxnumber recognition no longer works and the reports are send to faxmaker in binary format.
    Is it possible to generate reports in the same format as in the old version CR 8?
    Please help!
    Reinhard

    Sorry, we don´t understand your answer!
    If we uninstall CR XI, faxprinting works with the application.
    Installing CR XI and updating to the use of UNICODE therefore (as you wrote in your answer), does not work. We need a downgrade solution, so that we can print with CR XI installed!
    Or do you mean, we need a fax printing driver supporting unicode?
    But this would be a joke! The problem is CR XI and not GFI Faxmaker!

  • CR2008 Printing gibberish to one printer over Termianl Services (EasyPrint)

    Hi,
    We are using CR2008 SP4 in a C# project built in VS2010 targeting the .Net Framework 2. It is a WinForms app. We recently upgraded, with difficulty, from CR11R2 RDC.
    When one of our users, connecting to a W2K8 Terminal Server, prints to a printer networked on his own PC (a Brother HL 7050) a page of gibberish prints out. This happens when he prints directly (Report.PrintToPrinter) and when he prints from the Previewer. The Preview itself looks fine on screen. If he exports to PDF and then prints, it prints correctly.
    When I say garbled I mean:
    Each field appears to be in the correct space but the letters have all been substituted (mostly with numbers, slashes and little squares). In some cases it looks like pieces of text overlapping.
    Printing to the same Printer (albeit from a different Terminal Server) running an old CR11R5 RDC version of our Application works fine.
    Does anyone have any idea of what might be causing this?
    Any help would be much appreciated.
    Thanks,
    Fergus
    Edited by: FergusM on Jul 20, 2011 9:46 PM

    Thanks! That did the trick.
    Is there any easy way of checking if a printer driver supports unicode other than checking out the manufacturer's website?

  • Another Hex to Unicode Question

    public static void main(String[] args) {
          char ch = (char)Integer.parseInt("672c",16);
          System.out.println(ch);
          System.out.println("木"); //Character meant to show up in Hex - > Unicode print
    }According to the other questions and answers that I've read on the forum about changing a string hex into its equivalent Unicode character, what I have there should work. But it doesn't.
    I'm not sure if it'll be visible to everyone, but the second println() statement is the character that should be represented from the hex, but when I run the program in console the 1st print statement (Hex-> Unicode) outputs a "?" but the second works fine outputing exactly what I put it as.
    Is this a charset problem?
    Thanks

    By default most consoles print a very timited subset of the available unicode character set. You will have to make sure that they (the consoles) use a font capable of displaying the unicode characters that you wish to display. Since I have never had to do this I can't help you here but the following Swing example shows how it might be done in a Swing or AWT application.
    import java.awt.*;
    import javax.swing.*;
    public class Fred503 extends JPanel
        public Fred503()
            super(new GridLayout(0,2));
            char ch = (char)Integer.parseInt("672c",16);
            String[] fontNames =
                "Kochi Gothic",
                "Kochi Mincho",
                "Baekmuk Dotum",
                "Baekmuk Batang",
                "Baekmuk Gulim",
                "AR PL SungtiL GB",
                "AR PL KaitiM Big5",
                "AR PL KaitiM GB",
            for (int fontIndex = 0; fontIndex < fontNames.length; fontIndex++)
                JLabel label = new JLabel(fontNames[fontIndex] + " : ", JLabel.RIGHT);
                add(label);
                label = new JLabel(Character.toString(ch));
                label.setFont(new Font(fontNames[fontIndex], Font.PLAIN, 20));
                add(label);
        public static void main(String[] args)
            JFrame frame = new JFrame("Fred503");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(new Fred503());
            frame.pack();
            frame.setVisible(true);
    }

Maybe you are looking for