Unable to print chinese characters in Smartforms use Zebra printer

Hi,all.
My printer is Zebra ZM400 300dpi,I created a new output device 'TestDevice' and use the Lzeb3 Device type.
In my smartofrms i used the Zebra command to rotated text.Now the smartforms counld not print chinese characters but '#' instead.(style font 'ANDALE_S')
Anyone could help me....
Thanks Advance.
Andy Lee.

Hello Andy,
If you use the device type LZEBU3 with font ANDALE_S, then when you print then the SAP system
send a print control for activating the ANDALE font installed on the printer, and the text should
be outputed over this font.
When you get # during print then this means that the device type or the SAP font don't support
this character(this was the original problem), when you get a "space" then this means that the
font which is used by the printer don't support this character.
I think this can have 2 causes in your case:
1. The SAP system use the print control SF000 when you use ANDALE_S, which contains
the print control ^CI17^F8 in HEX form. This should activate the ANDALE font on your printer.
(You can find this under tr. SE73 -> Printer Fonts -> LZEBU3 -> ANDALE_S)
You should check wheter this is the correct print control. You should find on the printer an option
which list you all installed fonts, and also the print control which can be used for activating it.
Compare this print control from the printer with the above print control from the SAP system.
If you see a differnce then change the print control in the SAP system.(Before you do that please
copy the device type LZEBU3 into customer namespace, don't change the original SAP device type)
2. The font installed on the printer don't support the character which you use. Contact Zebra to confirm this, and ask for a ANDALE font which supports the character.
Best regards,
Norbert

Similar Messages

  • Printing Chinese Characters on Labels using ZEBRA

    Dear all,
    Could someone tell me how to Print Chinese characters on labels using ZEBRA Printer.
    Thanks & Regards,
    Joseph.

    Hi Joseph,
    How were u able to resolve your issue on Chinese font printing using Zebra? This is because I'm supposed to print Chinese texts & data using Zebra label printer. The problem is, inspite of using the Chinese font residing in the printer's memory card, i am not getting any output whenever i run a standard SAP report (VL74) calling a customized saprscipt report. Please help check my codes below. Also, I'm not sure of the command ^A1B, if it is still needed everytime i try to print a text, since i already used the command ^CW1,B:MSUNG.FNT.
    I placed them in the Main area of Sapscript. Thanks in advance.
    PERFORM 'GET_MORE_DATA' IN PROGRAM 'ZTEST'
    USING &NAST-KSCHL&
    USING &VBPLK-VENUM&
    USING &VBPLK-VPOBJKEY&
    USING &VBPLA-KUNWE&
    CHANGING &GF_MAKTX&
    CHANGING &GF_VEMNG&
    CHANGING &GF_KDMAT&
    CHANGING &GF_VBELN&
    CHANGING &GF_MATNR&
    ENDPERFORM
    /:NEW-PAGE
    / ^XA
    / ^CW1,B:MSUNG.FNT
    / DFZ5L3_L-1FS
    / ^PRC
    / LH0,0FS
    / ^LL1981
    / ^MD0
    / ^MNY
    / LH0,0FS
    / FO700,649A1B,48,0FRFN999^FS
    / FO1084,309A1B,46,0CI0FRFN998FS
    / FO315,330A1B,46,0CI0FRFN997FS
    / FO459,1351A1B,46,0CI0FRFN996FS
    / FO829,396A1B,46,0CI0FRFN995FS
    / FO54,1777A1B,46,0CI0FRFD中文 1FS
    / FO186,1774A1B,46,0CI0FRFD中文 2FS
    / FO318,1774A1B,46,0CI0FRFD中文 3FS
    / FO315,814A1B,46,0CI0FRFD中文 4FS
    / FO456,1777A1B,46,0CI0FRFD中文 5FS
    / FO12,18GB1162,1942,6^FS
    / FO147,18GB135,1942,6^FS
    / FO411,18GB135,1942,6^FS
    / FO660,18GB135,1942,6^FS
    / FO916,18GB135,1942,6^FS
    / ^XZ
    /:NEW-PAGE
    / ^XA
    / ^XFZ5L3_L-1.ZPL
    / FN999FD&GF_MAKTX&^FS
    / FN998FD&GF_VEMNG&^FS
    / FN997FD&GF_KDMAT&^FS
    / FN996FD&GF_VBELN&^FS
    / FN995FD&GF_MATNR&^FS
    / ^PQ1,0,1,N
    / ^XZ
    / ^FX End of job

  • Preview and Printing of Chinese Characters in Smartform

    Hi everyone!
    I have a development that needs to output in Smartform a combination of Chinese and English characters, on an English Logon,
    When I debug the form, the Chinese characters are shown in the debug screen, but when it is previewed or printed, it shows garbage.  Can anyone help me with this?
    Thanks a lot! Points for any helpful answer!

    Hi
    check this OSS Note
    OSS Note: 776507
    Symptom
    Documents printed via SAPscript or SmartForms do not print with correct special characters, e.g. ### prints instead of Japanese or Russian characters. What to do?
    Other terms
    SAPscript, SmartForms, printing, device types, OTF
    Reason and Prerequisites
    Help required to choose proper fonts in a SAPscript or SmartForm
    Solution
    When using SAPscript or SmartForms to print (or email or fax) a form from a business application, many factors influence the outcome of the actual text within the form. All these factors must be checked in order to ensure a correct printout:
    1) The language version of the form used to produce the printout.
    Example: If you want to print a French invoice, you need to have a FR version of your SAPscript or SmartForms invoice form RVINVOICE01. And the application program must specify the corresponding language key (FR) when calling the SAPscript or SmartForms API.
    2) The font selections specified in the form (possibly also in a SAPscript style or SmartStyle used in a form).
    Example: In a SAPscript form or a SmartStyle you need to specify HELVE if you want to print German text in Helvetica (or similar) font. If you want to print Japanese text, HELVE is not a valid choice but you need to specify a Japanese font like JPMINCHO in your Japanese form.
    3) The output character set of the device type
    Every printer in transaction SPAD has a "device type" assigned. Device types used by the spooler for printing support only one single specific output character set. All text from the form has to be converted (using SAP's built-in character conversion mechanism) to this output character set.
    A character set can typically support either a single language (e.g. Shift-JIS which supports only Japanese) or a set of languages (e.g. ISO 8859-1, which supports Western-European languages). It is possible that a given language (such as German) can be supported by several output character sets, e.g. you may use either ISO 8895-1 (Latin-1) or ISO 8859-2 (Latin-2) to represent German text. This is so because both character sets contain the special characters used in German.
    Example: HPLJ4000 is a HP LaserJet device type supporting the ISO 8859-1 (Latin-1) character set. ISO 8859-1 can be used to represent e.g. Dutch, English, French, German, Spanish, Swedish but NOT Russian or Japanese.
    As a consequence, it is ok to use HPLJ4000 to print English, German French etc. but not for Japanese or Russian.
    4) The set of available printer fonts for a given device type
    When formatting a document, SAPscript and SmartForms perform an automatic mapping of the font definitions in the form (e.g. "HELVE 14 point bold") and the available printer fonts of the device type. A replacement printer font is chosen, should the specified font selection not be available in the device type. Now this replacement can be problematic if a language-specific font, such as Chinese CNSONG, is specified in a form and it gets replaced by a font which does not support this language, e.g. COURIER.
    To solve this problem, font families in SE73 have language attribute assigned, e.g. some fonts are characterized as being suitable only for certain languages. And when a replacement has to be chosen because the original font from the form is not available in the device type, a replacement font is chosen which has the same language attributes.
    If no fonts for the language in question exist in the device type, the resulting font will not be able to print the special characters and you will see "wrong" output characters in the printout.
    Note on SAPscript/SmartForms Print Preview:
    The OTF Print Preview available in Windows GUI (e.g. from transaction SP01) will sometimes not show the "wrong" characters which appear on the final printout. Here is the reason: since the Print Preview runs in Windows environment, it will use Windows fonts to represent the actual printer fonts. A Windows font typically has more available characters (i.e. covers more character sets) than are actually available in a printer's resident font.
    A typical example where the Print Preview will differ from the printout is here: if you have a Chinese PCL5 printer such as CNHPLJ4 and use the Western Latin font COURIER in your document, the print preview will show you Chinese characters if you (by accident) tried to format Chinese characters in COURIER font. This is because Windows will automatically choose a font that can output Chinese characters (which is actually not Courier). But when you print the job on an actual PCL5 printer with resident Western and Chinese fonts, the Courier font will not print any Chinese characters but Western special characters instead, because the printer's resident Courier font does not include Chinese characters.
    Rule of thumb: all Asian device types (e.g. CNHPLJ4, JPHPLJ4, JPPOST, KPHPLJ4) support not only Asian fonts but also COURIER, HELVE and TIMES fonts. But these Latin fonts can only be used to print English text, not Chinese/Japanese/Korean characters.
    Which fonts are suitable for a given language?
    Language(s):            Font family to use in a form:
    Latin-1 (Western Europe/Americas) *******
    DE,EN,FR,ES,NL,SV       COURIER, HELVE, TIMES
                            (LETGOTH, LNPRINT)
    Latin-2 (Central Europe) ****************
    PL, CZ                  COURIER, HELVE, TIMES
    ISO 8859-4 (Baltic) *********************
    ET, LT, LV              COURIER, HELVE, TIMES
    ISO 8859-5 (Cyrillic) *******************
    BG, RU, SR, UK          COURCYR, HELVCYR, TIMECYR
    ISO 8859-7 (Greek) **********************
    EL                      COUR_I7, HELV_I7, TIME_I7
    ISO 8859-8 (Hebrew) *********************
    HE                      COURIER, HELVE, TIMES
    ISO 8859-9 (Turkish) ********************
    TR                      COURIER, HELVE, TIMES
    Simplified Chinese **********************
    ZH                      CNHEI, CNKAI, CNSONG
    Japanese ********************************
    JA                      JPMINCHO, DBMINCHO, DBGOTHIC
    Korean **********************************
    KP                      KPBATANG, KPDODUM, KPGULIM
                            KPGUNGSE, KPSAMMUL
    Traditional Chinese *********************
    ZF                      TWDPHEI, TWMING, TWSONG
    Thai ************************************
    TH                      THANGSAN, THDRAFT, THVIJIT
    Arabic (Unicode systems only) ***********
    AR                      ANDALE_J
    Verify your output by examining the OTF data
    When analysing printing problems of this type, be sure to check the OTF data which gets produced by SAPscript or SmartForms. OTF or "Output Text Format" is the intermediate page-description format generated from SAPscript or SmartForms. OTF will contain the final printer font names and character set/language identifiers which help to solve the problem. OTF will even name the form and the language of the form used to create the output.
    The easiest way to do this is to create a spool request from your application, run transaction SP01, use menu
    Goto->Display Requests->Settings
    and choose
    Display Mode: Raw
    Now display your spool request. If this is a SAPscript or SmartForms spool request, you will see OTF data. Each line represents one OTF command, every command starts with a 2-character cmd identifier and possibly some cmd parameters follow.
    Here is an excerpt from a sample OTF file where we highlight the most interesting commands:
    //XHPLJ8000    0700 00000000001
    IN04EALEXTEST_ZEBRA
    IN05%PAGE1
    OPDINA4  P 144  240 1683811906000010000100001
    IN06%WINDOW2
    MT0024401289
    CP11000000E
    FCHELVE  120  00109XSF100SF101110000067E X
    UL +0000000000000
    SW00067
    CT00000000
    ST0453037Dieses SF hat Stil ALEXTEST_ZEBRA mit
    The 1st line with the // (Control) command reveals the device type usedto print: HPLJ8000
    //XHPLJ8000    0700 00000000001
    The 2nd line (IN = Info command) shows the name and (internal 1-char)language key of the form:
    IN04EALEXTEST_ZEBRA
    In this case it is the English (E = EN) SmartForm ALEXTEST_ZEBRA
    The OP-line (OP = Open Page) gives the page format used in the form, it is DINA4 Portrait orientation:
    OPDINA4  P 144  240 1683811906000010000100001
    The CP (CodePage) cmd shows the SAP system codepage used to code the text and the active language. In our case it is codepage 1100 and language E = EN = English.
    CP11000000E
    Finally, the FC-cmd (Font Call) lists a printer font selected within SmartForms. Please note that every SmartForm has a designated default SmartStyle under "Form Attributes->Output Options". In addition, every text node can have a SmartStyle attached (which will override the definitions from the default style for the text). In our case the resulting printer font that was selected is HELVE 12.0 pt bold-off, italic-off.
    FCHELVE   120  00109XSF100SF101110000067E X
    Regards
    Anji

  • Unable to print chinese characters

    Hello experts,
    A script is triggered when i run the transaction FBL5N and a form is printed.
    The issue is, i am unable to see the chinese text in the preview as well as print.
    The chinese characters appers as ###, check boxesor some other symbols.
    Tried chaging the priner settings also(ouput device and device type)
    Tried changign the font family aslo.(CNKAI and CNHEI)
    The functional consultant says using the existing priner settings they are able to print chinese characters through some other transactions like VF03
    Waiting for positive responses.
    Regards
    Akmal

    See [note 302228 - NLS trouble shooting: printing (collective note)|http://service.sap.com/sap/support/notes/302228]: Characters on printout printed as nothing, #, ?, ., box, other character. It contains a detailed procedure how to analyze and solve. See also note 753381 which contains a Word document (attachment) with a more detailed classification of character damage.
    By the way, do you log in SAP in Chinese, do you have a Unicode system, do you use frontend printing, does your computer have Asian support installed, is the font installed on your computer?

  • Printing Chinese characters in XML Publisher - using RTF Template

    Hi All,
    I have to build RTF template for invoices report.
    When i run the report for US/UK operating units , it is working fine. But when i run the report for China invoice. Chinese characters were displaying like ?????
    Can any one help me how to fix this?? it is urgent issue...
    Thanks,
    MG

    Pl post details of OS, database and EBS versions, along with the database characterset.
    Are you creating PDF output ? Can you print Chinese characters when using US/UK operating units ? Are you using Pasta ?
    How to Generate PDF Output With UTF8 in R12? [ID 778970.1]
    HTH
    Srini

  • Printing Chinese Characters in Smart Forms

    Hi,
    Iu2019m trying to print Chinese characters via smart forms. However during print preview or print, all Chinese characters are showing as # symbols.
    I have researched and implemented for some possible solutions posted in the forum like:
    a.) Setting the regional language control panel.
    b.) Activating the multi-byte function in I18N.
    c.) Checked the output device is SWINCF.
    d.) Control parameter language is ZH (Chinese).
    Unfortunately it still doesnu2019t solve the problem. Any input is highly appreciated.
    With regards,
    Marc

    Remark following basics:
    Forms:
    Language of the form must be: "ZH".
    Due to a SAPNOTE only font family CN* (CNSONG etc.) is mapped.
    For frontend print, you must install chinese true type on you local PC and print via "CNSAPWIN" .
    For backend print, you must install neccesaary fonts in your printer to the resident fonts. You must use a printer like "CNHPL4" or so.
    For PDF archiving, you must upload truetype fonts to application server -> basis guys.
    Cascading Fonts:
    If you mix different subfonts to unicode areas, you must use CNSAPWINCF.
    Until now, only frontend printing is available.
    Note:
    Spool created for back end print with print preview is only a simulation of getting a picture of the output created with front end technology. So it can differ, when the printer does not have the resident fonts.
    Regards,
    Christian

  • Rotation of label using smartforms by 90 deg using zebra printer

    Hi,
    I am facing one problem using smartforms for label printing. Since the zebra printer which is being used requires 90 deg rotation of form for the normal smartform design. I have even tried using ZPL commands by using ^FWR  command in the window attributes but the text within that window only gets rotated and each line gets overwritten on one another. Please let me know if it s possible to rotate the complete form in smartform for label printing using zebra printer.
    Thanks and Regards
    Anand

    Hi Anand,
    Check my previous thread below about this:
    Re: print label landscape to zebra printer - text position wrong & overlapping
    regards,
    Aidan

  • Problem when printing Thai Characters in Smartform

    Hi All,
    When printing thai characters in smartform it takes more spaces between characters than required. I tried all possible font to adjust the character spacing.
    Can anyone help me out.
    Thanks,
    Khushboo Dand

    Dear Khushboo, Jag
    I have observed that tThe tiny boxes that are appearing in the Smartform text element is only occuring when you are printing a variable whose content is thai and nothing else with that. by nothing else i mean no THAI hardcoded text.
    if you try and check you will observe that when you try to print something like this in your Text element
    with your paragraph format alright/ output device and device type everythng in place
    eg:
    ของผู้มีเงินได้ &G_VAR& -
    is printing alright : content of G_VAR is thai characters
    but if you are printing just the variable
    eg:
    &G_VAR& --- it will print boxes
    to overcome this after trying no.of checks / online helps / settings etc etc which , ofcourse, did not help
    I did a lil bit trick with the system
    You can create a character format in your smartstyle with FONT : THANGSAN and maintain the COLOR as white
    now go to your text element key in a THAI character at the start or end of you variable and assign your new character format to that character. and Eureka! it will work
    eg: <CF> ข </>  &G_VAR&  - --- seen in your change editor
    where CF is the new "colorless" character format I have asked you to create.
    Thanks and Regards,
    Charu.
    Edited by: Charu Borkar on Aug 3, 2011 00.14 am

  • PO Print Output- Doesn't print Chinese characters

    Hi,
    There is customized t-code ZME9F similar to ME9F with an added feature of e-mail to vendor.
    When we process PO through ZME9F, the PO converted to PDF is not printing the chinese characters.when 'Display message' is clicked also it is fine.The print preview of the PO is fine.
    Can you please let me know what is the reason for not printing chinese characters in the conversion of PDF?
    Thanks in Advance,
    Sowmya

    Hi Soumya,
    Please check note 903157.
    Also the notes 812821, 83502, 776507 are helpful.
    Thanks,
    Ashwini.

  • WARNING: NEW-PAGE PRINT can no longer be used to print dialog box

    i am getting a warning as 'NEW-PAGE PRINT can no longer be used to print dialog box'. Please suggest what method can i use otherwise

    Please create a screenshot of the problem you're seeing by following the guide mentioned at [[How do I create a screenshot of my problem?]].
    Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. This will help us to visualize the problem.
    '''Try the Firefox Safe Mode''' to see how it works there. The Safe Mode is a troubleshooting mode, which disables most add-ons.''
    ''(If you're not using it, switch to the Default theme.)''
    * You can open the Firefox 4.0+ Safe Mode by holding the '''Shift''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Don't select anything right now, just use "'Start in Safe Mode"''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again.''
    '''''If it is good in the Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one.
    Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''

  • Printing sapscript label using zebra printer

    Hi,
    Can anybody please help me regarding "printing sapscript label using zebra printer"?
    i hav set the following print default settings in the transaction mb90:
    output device :
    NO01
    device type: YZZX_ZEB
    but when i try to print ,i am getting error message stating that "the respective sapscript form is not active ".
    i hav also attached my print program for ur easy reference.
    ====================================================================*
    FORM open_form_slv.
    *'  Description:
    *'  Add information for the SAP spooler
    *'  Change the name of the standard customized form for Zebra print
    *'  Last Change Vers Programmer   Reason
    *1
      DATA: BEGIN OF print_infos.
              INCLUDE STRUCTURE itcpo.
      DATA: END OF print_infos.
      DATA: form_name(16) TYPE c, char1(1) TYPE c, ind_beg TYPE i.
      PERFORM itcpo_fuellen.
      MOVE-CORRESPONDING itcpo TO print_infos.
      WRITE sy-datum USING EDIT MASK '__.__.____'
                                               TO print_infos-tdcovtitle+1.
      WRITE sy-uzeit USING EDIT MASK '__:__:__'
                                              TO print_infos-tdcovtitle+12.
      CONCATENATE itcpo-tddest sy-uname ' PO'(001) ekpo-ebeln ' Doc.No'(002)
                                           mseg-mblnr print_infos-tdcovtitle
                              INTO print_infos-tdcovtitle SEPARATED BY space.
    form name from the table YZZM_GR_LABEL
      IF NOT g_fonam IS INITIAL.
        tnapr-fonam = g_fonam.
      ENDIF.
    if the used printer is a Zebra label printer, then the customized
    layout set name ???_???_XXX will be changed to ???_???_ZP
      SELECT SINGLE * FROM  tsp03d WHERE  padest  = nast-ldest.
      IF tsp03d-patype = 'YZZX_ZEB'.
        ind_beg := 15.
        WHILE ind_beg > -1.
          char1 := tnapr-fonam+ind_beg.     " substr(tnapr-fonam,ind_beg,1)
          IF char1 = '_'.
            form_name := tnapr-fonam(ind_beg).
            CONCATENATE form_name '_ZP' INTO tnapr-fonam.
            EXIT.
          ENDIF.
          ind_beg := ind_beg - 1.
        ENDWHILE.
      ENDIF.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          device   = 'PRINTER'
          language = language
          OPTIONS  = print_infos
          form     = tnapr-fonam
          dialog   = ' '.
      x_open := x.
      IF mseg-weanz = 0. mseg-weanz = 1. ENDIF.
      IF syst-tcode <> 'MB90'  AND  NOT g_flag_popup IS INITIAL.
    check for requirement of printing label and ask for gr-quantities (popup)
        SELECT SINGLE * FROM yzzm_gr_quantity WHERE ebeln = mseg-ebeln.
        CLEAR yzzm_gr_quantity-no_popup.
      ELSE.
    and ask not for gr-quantities
        IF syst-tcode = 'MB90'.
          yzzm_gr_quantity-erfmg := mseg-menge.
        ELSE.
          yzzm_gr_quantity-erfmg := mseg-menge / mseg-weanz.
        ENDIF.
        yzzm_gr_quantity-no_popup := x.
      ENDIF.
    determination inspection lot number
      CLEAR qals-prueflos.
      SELECT SINGLE * FROM qals WHERE mblnr = mseg-mblnr
                           AND zeile = mseg-zeile
                           AND mjahr = mseg-mjahr.
    determination vendor batch
      CLEAR mch1-licha.
      SELECT SINGLE * FROM mch1 INTO mch1 WHERE matnr = mseg-matnr
                                            AND charg = mseg-charg.
    ENDFORM.                    "open_form_label
    =================================================================== *
    FORM we01_print_slv.
    *'  Description:
    *'  print out of hazardous symbol
    *'  controls the Zebra printer
    *'  Last Change Vers Programmer   Reason
    *****26.09.2007 Starts
      DATA: l_objky TYPE nast-objky,"Object key
            l_vstat TYPE nast-vstat. "Processing status of message
    *****26.09.2007 Starts
      TABLES: mgef, t300.
      FIELD-SYMBOLS: .
      DATA: aux_index LIKE sy-index.
      DATA: count_haz_sym, position TYPE n, zw TYPE p DECIMALS 1.
      DATA: aux_value(5) TYPE c.
      DATA: txt(10) TYPE c, pos(5) TYPE c.
      t001w-werks = r_werks.
      t001w-name1 = r_name1.
      PERFORM read_address.
    *2
      SELECT SINGLE * FROM ekpo WHERE ebeln = mseg-ebeln
                                  AND ebelp = mseg-ebelp.
      CLEAR mara-stoff.
      SELECT SINGLE stoff INTO mara-stoff FROM mara WHERE matnr = mseg-matnr.
      IF NOT mara-stoff IS INITIAL.
        CLEAR t300.
        SELECT SINGLE * FROM t300 WHERE lgnum = mseg-lgnum.
        IF NOT sy-subrc IS INITIAL.
      for plants without warehouses try to use the country code
          CASE mseg-werks.
            WHEN 'BUP'.
              t300-regkz := 'US '.
          ENDCASE.
        ENDIF.
        CLEAR mgef.
        SELECT SINGLE * FROM mgef WHERE stoff = mara-stoff
                                  AND   regkz = t300-regkz.
      ENDIF.
    in case of more then one label, use for each a new output window
    (not only for the first)
      IF g_count > 1.
        CALL FUNCTION 'CONTROL_FORM'
          EXPORTING
            command = 'NEW-WINDOW'.
      ENDIF.
    Ausgabe Gefahrstoffsysmbole        Neustadt,  V.Hilgert  14.07.98
    *For output type YNL7, the hazardous warning symbol has to be printed at  the bottom of the label.So label is called before that.
      IF tnapr-kschl = 'YNL7'.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            element = 'LABEL'.
      ENDIF.
      count_haz_sym = 0. position = 0.
      WHILE count_haz_sym  = 'XN'.
    For output type YNL7, the width of the standard text is small.
          IF tnapr-kschl = 'YNL7'.
            zw = position * '0.2' + '0.1'. pos = zw.
          ELSE.
            zw = position * '1.3' + '0.1'. pos = zw.
          ENDIF.
          IF tsp03d-patype = 'YZZX_ZEB'. " device type for ZEBRA label priter
            aux_value := count_haz_sym.
          ELSE.
            aux_value := pos.              " HP/Kyocera or other laser printer
          ENDIF.
          CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
            EXPORTING
              name   = '&XPOS&'
              value  = aux_value
            EXCEPTIONS
              OTHERS = 1.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element   =
              window    = 'MAIN'
            EXCEPTIONS
              element   = 1
              function  = 2
              type      = 3
              unopened  = 4
              unstarted = 5
              window    = 6
              OTHERS    = 7.
          IF sy-subrc = 0.
    *Varying the position for YNL7
            IF tnapr-kschl = 'YNL7'.
              position = position + 2.
            ELSE.
              position = position + 1.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDWHILE.
      IF NOT mseg-vfdat IS INITIAL.
        am07m-mhtxt = text-105.
      ENDIF.
      IF NOT am07m-mhdat IS INITIAL.
        am07m-mhztx = text-106.
      ENDIF.
      IF ekko-bsart = 'UB'.
        am07m-litxt = text-101.
        am07m-libzg = ekko-reswk.
      ELSE.
        am07m-litxt = text-100.
        am07m-libzg = ekko-lifnr.
      ENDIF.
      belpos-mblnr = mkpf-mblnr.
      belpos-zeile = mseg-zeile.
      CONDENSE belpos NO-GAPS.
      am07m-belpos = belpos.
      IF t156-shkzg = h.
        am07m-hdlne = text-020.
      ELSE.
        am07m-hdlne = text-010.
      ENDIF.
    Ausgabe der Etiketten mit den ind. Mengen
      IF NOT g_flag_popup IS INITIAL.
        SELECT SINGLE * FROM yzzm_gr_quantity WHERE ebeln = mseg-ebeln
                                              AND   weanz = g_count.
      ELSE.
    * print the number of labels is handeled by the Zebra printer
    IF tsp03d-patype = 'YZZX_ZEB'. " device type for Zebra label prts
    g_lbls_tot := mseg-weanz - g_count + 1.
    g_break_print := x.
    ENDIF.
    ENDIF.
    mseg-erfmg := yzzm_gr_quantity-erfmg.*
    ********26.09.2007 Starts
    CONCATENATE mseg-mblnr mseg-mjahr mseg-zeile INTO l_objky.
    SELECT SINGLE vstat INTO l_vstat FROM nast WHERE kappl = 'ME' AND
    objky = l_objky AND
    kschl = 'YNL7'.
    ********26.09.2007 Ends
    CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
    EXPORTING
    name = '&nummer&'
    value = g_count.
    IF tnapr-kschl <> 'YNL7'.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    element = 'LABEL'.
    else.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    ELEMENT = 'BAR_CODE'
    EXCEPTIONS
    ELEMENT = 1
    FUNCTION = 2
    TYPE = 3
    UNOPENED = 4
    UNSTARTED = 5
    WINDOW = 6
    BAD_PAGEFORMAT_FOR_PRINT = 7
    SPOOL_ERROR = 8
    CODEPAGE = 9
    OTHERS = 10.
    IF sy-subrc <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
      ENDIF.
    ENDFORM.                    "GR_label_print
    *&      Form  lesen
          text
         -->OBJKY      text
    FORM lesen USING objky.
      nast_key = objky.
      CLEAR retco.
      SELECT SINGLE * FROM mkpf WHERE mblnr = nast_key-mblnr
                                AND   mjahr = nast_key-mjahr.
      SELECT SINGLE * FROM mseg WHERE mblnr = mkpf-mblnr
                                AND   zeile = nast_key-zeile
                                AND   mjahr = mkpf-mjahr.
      IF sy-subrc NE 0.
        retco = sy-subrc.
        EXIT.
      ENDIF.
      PERFORM tab156_lesen.
      xskkz = t156-rstyp.
      PERFORM tab001w_lesen.
      IF NOT mseg-evers IS INITIAL.         "Versandvorschriften lesen.
        PERFORM t027_lesen.
      ENDIF.
      PERFORM bestellung_lesen.
      IF NOT ekpo-knttp IS INITIAL AND NOT
             ekpo-weunb IS INITIAL.
        PERFORM kontierung_lesen.           "für multikontierte Bestellungen
      ENDIF.
      IF NOT mseg-ematn IS INITIAL.
        PERFORM lesen_htn.
      ELSE.                                                     "111277/PH
        CLEAR am07m-mfrpn.                                      "111277/PH
      ENDIF.
      IF mseg-matnr IS INITIAL.
        mseg-menge = mseg-bpmng.
        mseg-meins = mseg-bprme.
        PERFORM bestelltext_lesen.
        CLEAR mabdr.
      ELSE.
        PERFORM material_lesen.
      ENDIF.
      PERFORM tab024_lesen.
      PERFORM t064b_lesen.
      PERFORM ladr_lesen.
    ENDFORM.                    "lesen
    Lesen für WE-Schein Fert.Auftrag -
    FORM lesen_wf USING objky.
      nast_key = objky.
      CLEAR retco.
      SELECT SINGLE * FROM mkpf WHERE mblnr = nast_key-mblnr
                                AND   mjahr = nast_key-mjahr.
      SELECT SINGLE * FROM mseg WHERE mblnr = mkpf-mblnr
                                AND   zeile = nast_key-zeile
                                AND   mjahr = mkpf-mjahr.
      IF sy-subrc NE 0.
        retco = sy-subrc.
        EXIT.
      ENDIF.
      PERFORM tab156_lesen.
      xskkz = t156-rstyp.
      PERFORM tab001w_lesen.
      PERFORM auftrag_lesen.
      IF NOT mseg-matnr IS INITIAL.
        PERFORM material_lesen.
      ELSE.
        mseg-menge = mseg-erfmg.
        mseg-meins = mseg-erfme.
      ENDIF.
      PERFORM tab024d_lesen.
      PERFORM t064b_lesen.
      PERFORM ladr_lesen.
    ENDFORM.                    "lesen_wf
    Lesen für Warenausgang -
    FORM lesen_wa USING objky.
      nast_key = objky.
      CLEAR retco.
      SELECT SINGLE * FROM mkpf WHERE mblnr = nast_key-mblnr
                                AND   mjahr = nast_key-mjahr.
      SELECT SINGLE * FROM mseg WHERE mblnr = mkpf-mblnr
                                AND   zeile = nast_key-zeile
                                AND   mjahr = mkpf-mjahr.
      IF sy-subrc NE 0.
        retco = sy-subrc.
        EXIT.
      ENDIF.
      PERFORM tab156_lesen.
      xskkz = t156-rstyp.
      PERFORM tab001w_lesen.
      IF NOT mseg-matnr IS INITIAL.
        PERFORM material_lesen.
      ENDIF.
      PERFORM ladr_lesen.
    ENDFORM.                    "lesen_wa
    Druck Vorbereiten -
    FORM open_form.
      PERFORM itcpo_fuellen.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          device   = 'PRINTER'
          language = language
          OPTIONS  = itcpo
          dialog   = ' '.
      PERFORM lesen_t159p.
      x_open = x.
    ENDFORM.                    "open_form
    Druck Vorbereiten Sammelscheine -
    FORM open_form_sammel.
      PERFORM lesen_t159p.
      PERFORM itcpo_fuellen.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          device   = 'PRINTER'
          language = language
          OPTIONS  = itcpo
          form     = tnapr-fonam
          dialog   = ' '.
      x_open = x.
    ENDFORM.                    "open_form_sammel
    Druck schließen -
    FORM close_form.
      CHECK NOT x_open IS INITIAL.
      CALL FUNCTION 'CLOSE_FORM'.
      CLEAR x_open.
    ENDFORM.                    "close_form
    Hilfsfelder versorgen für Sammelscheindruck -
    FORM helpdata1.
       *mkpf = mkpf.
       *mseg-lgort = mseg-lgort.
       *ladr = ladr.
      save_mkpf = *mkpf-usnam.
      save_mblnr = *mkpf-mblnr.
      save_budat = *mkpf-budat.
      save_cpudt = *mkpf-cpudt.
      save_ematn = *mseg-ematn.
      save_lgort = *mseg-lgort.
      save_ladr = *ladr.
       *t001w = t001w.
      save_werks = *t001w-werks.
      save_name1 = *t001w-name1.
       *ekko = ekko.
       *am07m = am07m.
      save_lifnr = *ekko-lifnr.
      save_ebeln = *ekko-ebeln.
      save_ekgrp = *ekko-ekgrp.
      save_linam = *am07m-name1.
      save_lina2 = *am07m-name2.
       *t024 = t024.
      save_eknam = *t024-eknam.
      save_ektel = *t024-ektel.
       *mkpf-usnam = old_mkpf.
       *mkpf-mblnr = old_mblnr.
       *mkpf-cpudt = old_cpudt.
       *mkpf-budat = old_budat.
       *mseg-ematn = old_ematn.
       *mseg-lgort = old_lgort.
       *ladr = old_ladr.
       *t001w-werks = old_werks.
       *t001w-name1 = old_name1.
       *t024-eknam = old_eknam.
       *t024-ektel = old_ektel.
       *ekko-lifnr = old_lifnr.
       *ekko-ebeln = old_ebeln.
       *ekko-ekgrp = old_ekgrp.
       *am07m-name1 = old_linam.
       *am07m-name2 = old_lina2.
      save_lfa1  = lfa1.
      IF NOT old_lfa1 IS INITIAL.
        lfa1  = old_lfa1.
      ENDIF.
    ENDFORM.                                                    "helpdata1
    --- Versorgung der Hilfsfelder vor CLOSE_FORM bei Sammelscheindruck --
    FORM helpdata2.
      old_lfa1 = save_lfa1.
      lfa1     = save_lfa1.
      old_mkpf = save_mkpf.
      old_lgort = save_lgort.
      old_ladr = save_ladr.
      old_budat = save_budat.
      old_cpudt = save_cpudt.
      old_werks = save_werks.
      old_name1 = save_name1.
      old_mblnr = save_mblnr.
      old_lifnr = save_lifnr.
      old_linam = save_linam.
      old_lina2 = save_lina2.
      old_ebeln = save_ebeln.
      old_ekgrp = save_ekgrp.
      old_eknam = save_eknam.
      old_ektel = save_ektel.
      old_ematn = save_ematn.
       *mkpf-usnam = save_mkpf.
       *mkpf-mblnr = save_mblnr.
       *mkpf-budat = save_budat.
       *mkpf-cpudt = save_cpudt.
       *mseg-ematn = save_ematn.
       *mseg-lgort = save_lgort.
       *ladr = save_ladr.
       *t001w-werks = save_werks.
       *t001w-name1 = save_name1.
       *t024-eknam  = save_eknam.
       *t024-ektel  = save_ektel.
       *ekko-lifnr  = save_lifnr.
       *ekko-ebeln  = save_ebeln.
       *ekko-ekgrp  = save_ekgrp.
       *am07m-name1 = save_linam.
       *am07m-name2 = save_lina2.
    ENDFORM.                                                    "helpdata2
    Form Lesen Warenausgang Lohnbearbeiter -
    FORM lesen_wlb USING objky.
      nast_key = objky.
      CLEAR retco.
      SELECT SINGLE * FROM mkpf WHERE mblnr = nast_key-mblnr
                                AND   mjahr = nast_key-mjahr.
      SELECT SINGLE * FROM mseg WHERE mblnr = mkpf-mblnr
                                AND   zeile = nast_key-zeile
                                AND   mjahr = mkpf-mjahr.
      IF sy-subrc NE 0.
        retco = sy-subrc.
        EXIT.
      ENDIF.
      PERFORM tab156_lesen.
      xskkz = t156-rstyp.
      PERFORM tab001w_lesen.
      IF NOT mseg-matnr IS INITIAL.
        PERFORM material_lesen.
      ENDIF.
      ON CHANGE OF mseg-lifnr.
        PERFORM read_address.
      ENDON.
    ENDFORM.                    "lesen_wlb
    *eject
    Fuellen der ITCPO -
    FORM itcpo_fuellen.
      IF xscreen NE space.
    *- Testausgabe auf Bildschirm -
        itcpo-tdpreview = 'X'.
        itcpo-tdnoprint = 'X'.
      ELSE.
        CLEAR: itcpo-tdpreview,
               itcpo-tdnoprint.
      ENDIF.
      MOVE-CORRESPONDING nast TO itcpo.
      itcpo-tdcover   = nast-tdocover.
      itcpo-tddest    = nast-ldest.
      itcpo-tddataset = nast-dsnam.
      itcpo-tdsuffix1 = nast-dsuf1.
      itcpo-tdsuffix2 = nast-dsuf2.
      itcpo-tdimmed   = nast-dimme.
      itcpo-tddelete  = nast-delet.
      itcpo-tdcopies  = nast-anzal.
      itcpo-tdprogram = sy-repid.
    ITCPO-TDTELELAND = US_COUNTRY.
      itcpo-tdsenddate = nast-vsdat.
      itcpo-tdsendtime = nast-vsura.
      itcpo-tdnewid   = x.
    ENDFORM.                    "itcpo_fuellen
    *eject.
    ------------ FORM lesen der Lagerortadr. ---------------------------*
    FORM ladr_lesen.
      DATA:    BEGIN OF addr_sel.
              INCLUDE STRUCTURE addr1_sel.
      DATA:    END OF addr_sel.
      CLEAR ladr.
      SELECT SINGLE * FROM twlad WHERE werks = mseg-werks
                           AND  lgort = mseg-lgort
                           AND  lfdnr = '001'.
      IF NOT twlad-adrnr IS INITIAL AND sy-subrc IS INITIAL.
        MOVE twlad-adrnr TO addr_sel-addrnumber.
      ENDIF.
      CALL FUNCTION 'ADDR_GET'
        EXPORTING
          address_selection = addr_sel
        IMPORTING
          sadr              = ladr
        EXCEPTIONS
          OTHERS            = 1.
    ENDFORM.                    "ladr_lesen
    **&      Form  REPRINT
          text
    *FORM reprint.
    TABLES : nase.
    DATA  : x TYPE string.
    IF nase-vermo = 2.
       x = 'REPRINT'.
    ENDIF.
    *ENDFORM.                    "REPRINT
    Kindly do the needful.
    Thanks in advance
    Regards
    Swarna

    Hi Swarna,
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    device = 'PRINTER'
    language = language
    OPTIONS = print_infos
    <b>form = tnapr-fonam</b>
    dialog = ' '.
    x_open := x.
    I thing its not a good way to pass the Form name to the Parameter.
    Try like,
    data : temp_form like tnapr-fonam.
    <b>form = temp_form</b>
    Thanks.

  • Printing chinese characters in a zebra printer using SAP Interactive Forms

    Hello,
    We have created an Adobe Interactive Forms in SAP with transaction SFP. In this form we have used some words in English and another ones using Simplified Chinese characters . We have defined a Zebra printer in SPAD transaction using Device Type AZPL203.
    We have defined an ABAP program to printout this form. When we print it in the zebra printer some of the chinese characters are printed and some of them no.
    Has anyone faced the same problem?
    Please if this is not the right forum, please could you adress me to the right one?
    Thanks a lot
    Miquel A. Vergara

    Hello,
    Please check if the notes below are useful.
    83502 - Printing Support for Native Languages
    1612051 - Foreign text printed with garbage characters
    Thanks,
    Ravi

  • Printing chinese characters on a Zebra printer using Adobe Interactive Form

    Hello,
    We have created an Adobe Interactive Forms in SAP with some words in English and another one in simplified chinese. We have defined a Zebra printer in SPAD with the AZPL203 driver.
    When we print the form in the zebra printer some of the chinese characters are printed and some of them no.
    Has anyone faced the same problem?
    Thanks a lot
    Miquel A. Vergara

    Hi,
    Welcome you post on the forum.
    However, this is not the right forum for you. It is only for SAP Business One user. Please search entire forums first to find which one is more proper.
    However, this issue may not be related to SAP at all. Search on the web would be better.
    Thanks,
    Gordon

  • Problem in printing Chinese characters by using JavaPrintService

    Hi, I just develop a tool to print txt files by using Java Print Service.
    Everything seems to be good, but when the file contains Chinese character, it can't be print correctly.
    I tried to use the DocFlavor.Reader and DocFlavor.STRING, however all of them are failed.
    My code is below, please help me, thanks so much
    PrintRequestAttributeSet pars = new HashPrintRequestAttributeSet();
    // TODO:Printing is not correct because of the Chinese Encoding
    DocFlavor flavor = new DocFlavor.INPUT_STREAM("text/plain;charset=UTF-8");//DocFlavor.INPUT_STREAM.AUTOSENSE;
    PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
    if(defaultService != null){
    Iterator<String> it = filename.iterator();
    while(it.hasNext()){
    shortname = it.next().toString();
    abstractPath = GlobalVar.SRC_DIRECTORY_PATH + shortname;
    File file = new File(abstractPath);
    if(file.exists()){
    try{
    DocPrintJob job = defaultService.createPrintJob();
    FileInputStream fis = new FileInputStream(file);
    //BufferedReader br = new BufferedReader(new InputStreamReader(fis,"UTF-8"));
    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc = new SimpleDoc(fis,flavor,das);
    job.print(doc, pars);
    }catch(PrintException ex){
    Log.doLog("Print failed\t" + shortname, Log.ERROR);
    System.out.println(ex.fillInStackTrace());
    }else{
    Log.doLog("File can't be found: "+abstractPath, Log.ERROR);
    }else{
    Log.doLog("Can't find printer", Log.ERROR);
    }

    Everything seems to be good, but when the file contains Chinese character, it can't be print correctly.And how exactly did you determine that the character set in that file is UTF8?

  • Printing Chinese characters

    Hello all,
    I have been wriiten a program that prints styled Chinese characters,
    using TextLayout class. The strokes are incorrect, some shorter, some longer.
    The TextLayout firstly layout the text and attributes with specified width
    and height (in case word wrapping is needed), then when printing , the Graphics
    object pass into the textLayout.draw method to print the text. I found that
    there is no problem when rendering on screen, and also print using drawString
    method. Is anyone know how to solve this problem? thanks in advance. Here is
    the standalone testing program.
    Jason
    import java.text.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.font.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import java.awt.image.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    public class Test extends JFrame {
    public static void main(String[] args) {
    Locale.setDefault(Locale.CHINESE);
    Test test = new Test();
    test.setVisible(true);
    PrinterJob job;
    PageFormat pageFormat;
    DrawingPanel drawingPanel = new DrawingPanel();
    JPanel buttonPanel = new JPanel();
    JButton printButton = new JButton("Print");
    Test() {
    super("Test");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    drawingPanel.setPreferredSize(new Dimension(500, 400));
    getContentPane().add(drawingPanel, BorderLayout.CENTER);
    printButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    job = PrinterJob.getPrinterJob();
    pageFormat = job.defaultPage();
    job.setPrintable(drawingPanel, pageFormat);
    job.setCopies(1);
    if (job.printDialog()) {
    try {
    job.print();
    catch (Exception e) {
    System.out.println("FilePrint : " + e);
    buttonPanel.add(printButton);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    pack();
    class DrawingPanel extends JPanel implements Printable {
    static final String chineseText = "\ufe51\ufe50\ufe55\ufe54\ufe56\ufe57\u300c\u300d\u3002\u3010\u3011\u3014\u3015\u4e0d\u662f\u516c\u6709\u7684; \u4e0d\u80fd\u88ab\u5916\u90e8\u5305";
    DefaultStyledDocument document = new DefaultStyledDocument();
    String text = chineseText;
    Vector textVector;
    Vector attrStrVector;
    int x = 0;
    int y = 0;
    int width = 400;
    int height = 400;
    int lineSpacing = 5;
    Color textColor = Color.black;
    DrawingPanel() {
    super(false);
    try {
    SimpleAttributeSet attrSet1 = new SimpleAttributeSet();
    document.insertString(0, chineseText, attrSet1);
    catch (BadLocationException ble) {
    public void draw(Graphics2D g,int x,int y) {
    Vector cache = layout(g);
    textDraw(g, cache, x, y);
    private void textDraw(Graphics2D g2d,Vector cache,int offsetX,int offsetY) {
    int accHeight = 0;
    for (int i=0; i < cache.size(); i++) {
    TextLayout textLayout = (TextLayout)cache.elementAt(i);
    accHeight += textLayout.getAscent();
    g2d.setColor(textColor);
    textLayout.draw(g2d, offsetX + x + 1,
    offsetY + y + 1 + accHeight);
    accHeight += (textLayout.getDescent() + (textLayout.getLeading() * lineSpacing));
    textVector.clear();
    attrStrVector.clear();
    public void paint(Graphics _g) {
    Graphics2D g = (Graphics2D) _g;
    g.setColor(Color.white);
    g.fillRect(0, 0, getWidth(), getHeight());
    draw(g, 10, 10);
    g.dispose();
    public int print(Graphics _g, PageFormat pageFormat, int pageIndex) throws PrinterException {
    if (pageIndex >= 1) {
    _g.dispose();
    return Printable.NO_SUCH_PAGE;
    RepaintManager.currentManager(this).setDoubleBufferingEnabled(false);
    Graphics2D g = (Graphics2D) _g;
    g.setColor(Color.white);
    g.fillRect(0,
    0,
    (int)pageFormat.getWidth(),
    (int)pageFormat.getHeight());
    int newOffsetX = 0;
    int newOffsetY = (int)(pageFormat.getImageableHeight() * pageIndex);
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    RenderingHints.VALUE_ANTIALIAS_ON);
    g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
    RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g.setClip((int) pageFormat.getImageableX(),
    (int) pageFormat.getImageableY(),
    (int) (pageFormat.getImageableWidth()),
    (int) (pageFormat.getImageableHeight()));
    draw(g,
    (int)(x - newOffsetX + pageFormat.getImageableX()),
    (int)(y - newOffsetY + pageFormat.getImageableY()));
    RepaintManager.currentManager(this).setDoubleBufferingEnabled(true);
    g.dispose();
    return Printable.PAGE_EXISTS;
    private Vector layout(Graphics2D g) {
    Vector cache = new Vector();
    float accHeight = 0;
    TextFormatting formatting = new TextFormatting(document, text);
    textVector = formatting.getTextVector();
    attrStrVector = formatting.getAttrStrVector();
    for (int j = 0; j < attrStrVector.size(); j++) {
    String text = (String)textVector.elementAt(j);
    if (text.length() == 0) {
    AttributedString spaceAs = new AttributedString(" ");
    AttributedCharacterIterator spaceAci = spaceAs.getIterator();
    FontRenderContext spaceFrc = g.getFontRenderContext();
    TextLayout spaceTl = new TextLayout(spaceAci,spaceFrc);
    float spaceHeight = spaceTl.getAscent() + spaceTl.getDescent() + spaceTl.getLeading();
    accHeight += spaceHeight;
    cache.addElement(spaceTl);
    continue;
    AttributedString as = (AttributedString)attrStrVector.elementAt(j);
    FontRenderContext frc = g.getFontRenderContext();
    AttributedCharacterIterator aci = as.getIterator();
    LineBreakMeasurer lbm = new LineBreakMeasurer(aci,frc);
    lbm.setPosition(0);
    int i = 0;
    while (true) {
    TextLayout textLayout = lbm.nextLayout(width - 2);
    if (textLayout == null)
    break;
    accHeight += (textLayout.getAscent() + textLayout.getDescent());
    if (accHeight > height - 2)
    break;
    cache.addElement(textLayout);
    accHeight += (textLayout.getLeading() * lineSpacing);
    return cache;
    class TextFormatting {
    DefaultStyledDocument document;
    String text;
    Vector textVector = new Vector();
    Vector attrStrVector = new Vector();
    TextFormatting(DefaultStyledDocument document, String text) {
    this.document = document;
    this.text = text;
    format();
    private void format() {
    boolean quit = false;
    int index = 0, increment = 1;
    int nextIndex;
    int textIndex = 0;
    String subText;
    if (text.indexOf("\r\n") != -1)
    increment = 2;
    while (!quit) {
    if (increment == 2)
    nextIndex = text.indexOf("\r\n",index);
    else
    nextIndex = text.indexOf("\n",index);
    if (nextIndex == -1) {
    subText = text.substring(index);
    quit = true;
    else {
    subText = text.substring(index,nextIndex);
    textVector.addElement(subText);
    AttributedString as = new AttributedString(subText);
    for (int i = 0; i < subText.length(); i++) {
    Element ele = document.getCharacterElement(textIndex++);
    AttributeSet attrSet = ele.getAttributes();
    Font f = document.getFont(attrSet);
    as.addAttribute(TextAttribute.FONT, f, i, i + 1);
    if (StyleConstants.isUnderline(attrSet)) {
    as.addAttribute(TextAttribute.UNDERLINE,
    TextAttribute.UNDERLINE_ON,
    i,
    i + 1);
    attrStrVector.addElement(as);
    index = nextIndex + increment;
    textIndex++;
    public Vector getTextVector() {
    return this.textVector;
    public Vector getAttrStrVector() {
    return this.attrStrVector;

    Amending the above question:
    I am using Window 98 Taiwan Edition, JDK1.3.1 international, and I have set locale to TW (Taiwan)
    Jason

Maybe you are looking for