How can i print text contain multiple language

hi all,
i have swing application with JTextPane contains multiple data (kannada and English)
i used to the follwoing code to print contatent of jtextPane and in this code i seted
font Kedage(for kannada)
if did not set to kannada font the kannada test is printing squre box
if i set english font than kannada the english font is squre box,
here how can i identify the the character is kannada and english
help me to solve this problem or suggest me any other way to print multiple language
text in JTextPane.
     public void printMeetingDetails(String meetingDate){
               PrintJob pjob = getToolkit().getPrintJob(new JFrame(), "Meeting Details", new Properties());
                if (pjob != null) {
                  Graphics pg = pjob.getGraphics();
                  if (pg != null) {
                    String s1 = taMeetingDetails.getText();
                    s1 = s1 + "\n Resolution :";
                    //String s2 = "\n This is the second paragraph for printing after the sample java code.";
                    String s2 = "\t"+taResolution.getText();
                    printLongString (pjob, pg, s1,s2);
                    pg.dispose();
                  pjob.end();
          private int margin = 72;
            // Print string to graphics via printjob
            // Does not deal with word wrap or tabs
            private void printLongString (PrintJob pjob, Graphics pg, String strEng,String strKan) {
              int pageNum = 1;
              int linesForThisPage = 0;
              int linesForThisJob = 0;
              // Note: String is immutable so won't change while printing.
              if (!(pg instanceof PrintGraphics)) {
                throw new IllegalArgumentException ("Graphics context not PrintGraphics");
              StringReader srEng = new StringReader (strEng);
              StringReader srKan = new StringReader (strKan);
              LineNumberReader lnrEng = new LineNumberReader (srEng);
              LineNumberReader lnrKan = new LineNumberReader (srKan);
              String nextLine;
              int pageHeight = pjob.getPageDimension().height - margin;
            // Font helv = new Font("Kedage", Font.PLAIN, 12);
              Font helv = new Font("Kedage", Font.PLAIN, 12);
              //have to set the font to get any output
              pg.setFont (helv);
              FontMetrics fm = pg.getFontMetrics(helv);
              int fontHeight = fm.getHeight();
              int fontDescent = fm.getDescent();
              int curHeight = margin;
              try {
                do {
                  nextLine = lnrEng.readLine();
                  if (nextLine != null) {        
                    if ((curHeight + fontHeight) > pageHeight) {
                      // New Page
                      System.out.println ("" + linesForThisPage + " lines printed for page " + pageNum);
                      if (linesForThisPage == 0) {
                         System.out.println ("Font is too big for pages of this size; aborting...");
                         break;
                      pageNum++;
                      linesForThisPage = 0;
                      pg.dispose();
                      pg = pjob.getGraphics();
                      if (pg != null) {
                        pg.setFont (helv);
                      curHeight = 0;
                    curHeight += fontHeight;
                    if (pg != null) {
                      pg.drawString (nextLine, margin, curHeight - fontDescent);
                      linesForThisPage++;
                      linesForThisJob++;
                    } else {
                      System.out.println ("pg null");
                } while (nextLine != null);
                Font fMyFont = new Font("Kedage", Font.PLAIN, 12); //for kannada
                //have to set the font to get any output
                pg.setFont (fMyFont);
                fm = pg.getFontMetrics(fMyFont);
                fontHeight = fm.getHeight();
                fontDescent = fm.getDescent();
                curHeight += fontHeight;
                do {
                  nextLine = lnrKan.readLine();
                  if (nextLine != null) {        
                    if ((curHeight + fontHeight) > pageHeight) {
                      // New Page
                      System.out.println ("" + linesForThisPage + " lines printed for page " + pageNum);
                      if (linesForThisPage == 0) {
                         System.out.println ("Font is too big for pages of this size; aborting...");
                         break;
                      pageNum++;
                      linesForThisPage = 0;
                      pg.dispose();
                      pg = pjob.getGraphics();
                      if (pg != null) {
                        pg.setFont (fMyFont);
                      curHeight = 0;
                    curHeight += fontHeight;
                    if (pg != null) {
                      pg.drawString (nextLine, margin, curHeight - fontDescent);
                      linesForThisPage++;
                      linesForThisJob++;
                    } else {
                      System.out.println ("pg null");
                } while (nextLine != null);
              } catch (EOFException eof) {
                // Fine, ignore
              } catch (Throwable t) { // Anything else
                t.printStackTrace();
            }thanks
daya

hi all,
i have swing application with JTextPane contains multiple data (kannada and English)
i used to the follwoing code to print contatent of jtextPane and in this code i seted
font Kedage(for kannada)
if did not set kannada font then kannada text is not printing porperly(printg squre box)
if i set kannada font then english font is squre box,
here how can i identify the the character is kannada and english characater
help me to solve this problem or suggest me any other way to print content of jtextpane which is in multiple language text.
public void printMeetingDetails(String meetingDate){
               PrintJob pjob = getToolkit().getPrintJob(new JFrame(), "Meeting Details", new Properties());
                if (pjob != null) {
                  Graphics pg = pjob.getGraphics();
                  if (pg != null) {
                    String s1 = taMeetingDetails.getText();
                    s1 = s1 + "\n Resolution :";
                    //String s2 = "\n This is the second paragraph for printing after the sample java code.";
                    String s2 = "\t"+taResolution.getText();
                    printLongString (pjob, pg, s1,s2);
                    pg.dispose();
                  pjob.end();
          private int margin = 72;
            // Print string to graphics via printjob
            // Does not deal with word wrap or tabs
            private void printLongString (PrintJob pjob, Graphics pg, String strEng,String strKan) {
              int pageNum = 1;
              int linesForThisPage = 0;
              int linesForThisJob = 0;
              // Note: String is immutable so won't change while printing.
              if (!(pg instanceof PrintGraphics)) {
                throw new IllegalArgumentException ("Graphics context not PrintGraphics");
              StringReader srEng = new StringReader (strEng);
              StringReader srKan = new StringReader (strKan);
              LineNumberReader lnrEng = new LineNumberReader (srEng);
              LineNumberReader lnrKan = new LineNumberReader (srKan);
              String nextLine;
              int pageHeight = pjob.getPageDimension().height - margin;
            // Font helv = new Font("Kedage", Font.PLAIN, 12);
              Font helv = new Font("Kedage", Font.PLAIN, 12);
              //have to set the font to get any output
              pg.setFont (helv);
              FontMetrics fm = pg.getFontMetrics(helv);
              int fontHeight = fm.getHeight();
              int fontDescent = fm.getDescent();
              int curHeight = margin;
              try {
                do {
                  nextLine = lnrEng.readLine();
                  if (nextLine != null) {        
                    if ((curHeight + fontHeight) > pageHeight) {
                      // New Page
                      System.out.println ("" + linesForThisPage + " lines printed for page " + pageNum);
                      if (linesForThisPage == 0) {
                         System.out.println ("Font is too big for pages of this size; aborting...");
                         break;
                      pageNum++;
                      linesForThisPage = 0;
                      pg.dispose();
                      pg = pjob.getGraphics();
                      if (pg != null) {
                        pg.setFont (helv);
                      curHeight = 0;
                    curHeight += fontHeight;
                    if (pg != null) {
                      pg.drawString (nextLine, margin, curHeight - fontDescent);
                      linesForThisPage++;
                      linesForThisJob++;
                    } else {
                      System.out.println ("pg null");
                } while (nextLine != null);thanks
daya

Similar Messages

  • How can i print text messages from my htc amaze to my deskjet 3050A

    how can i print text messages from my htc amaze to my hp deskjet 3050A

    Hi,
    I believe the phone uses Android OS, v2.3.4 (Gingerbread) therefore you can use one of these applications:
       http://www.printeron.com/apps/androidprinting.html
       https://market.android.com/details?id=com.pauloslf​.cloudprint&hl=en
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How can i print text message from my iPhone?

    I have an iPhone 5S.  How can I print text messages to save those conversations?

    Did you try to copy and paste the content into another app, like notes or Mail and then send it to the printer?

  • How can I print texts from iPhone4 to Canon MX870

    How can I print texts from iPhone4 to Canon MX870

    The following gives instructions. http://support.apple.com/kb/HT4517
    Note that your carrier may not support it or may have added charges.
    To use this feature, enable Personal Hotspot on your cellular data plan. Contact your carrier for information and pricing.

  • How can I have text from multiple fields on one layer, copy to one field on another layer?

    A little help please as it's been years since I've done any coding of any sort.
    So I have a 4 page document with various field types.  I have a document script that gets "TodaysDate" that works perfectly and a few other scripts as well.
    So what I'm trying to do is find a work around for the following:
    I have 3 fields - SURNAME, FIRSTNAME & dob.
    And I want what is typed into these fields to populate into 1 field.  And according to this tutorial (http://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript) it's not exactly possible.  At least I think that's what it says.
    However I'm hoping that maybe I could have a Submit button at the end of that document that when clicked would copy the text from those 3 fields (that I would have on 1 layer) into 1 field on a 2nd layer.  Is that even possible??
    I'd also like to have the document Print, Save (using the text in the field on the 2nd layer as the file name), Email (using the text in the field on the 2nd layer as the subject line) and Export to a specific Excel spreadsheet. 
    I don't want much do I?
    I'm using Acrobat 9 Pro on a Windows PC but also have access to Acrobat 8 Professional.  And I'm going to want the form to run in Acrobat Reader X.
    So far I have for the 3 fields into 1 on another layer:
    function buttonClick(){
    if(buttonClick==false)
    event.value=this.getField("SURNAME"+"-"+"FIRSTNAME"+"-"+"dob").valueAsString;
    But I have no idea how to call the event.value from 1 layer to another or if any of that code above would even work at all.
    I have a script that I believe will work perfectly for the Save and Email function:
    Using the “doc.submitForm()” function
    // This is the form return e-mail. Its hardcoded
    // so that the form is always returned to the same address
    // Change address on your form
    var cToAddr = "[email protected]";
    // First, get the client CC e-mail address
    var cCCAddr = this.getField("ClientEmail").value;
    // Now get the beneficiary e-mail only if it is filled out
    var cBenAddr = this.getField("BennyEmail").value;
    if(cBenAddr != "") cCCAddr += ";" + cBenAddr;
    // Set the subject and body text for the e-mail message
    var cSubLine = "Form X-1 returned from client"; var cBody = "Thank you for submitting your form.\n" + "Save the mail attachment for your own records";
    //** Send the form data as an XML attachment on an e-mail
    // Build the e-mail URL
    var cEmailURL = "mailto:[email protected]?cc=" + cCCAddr + "&subject=" + cSubLine + "&body=" + cBody;
    this.submitForm({
                cURL: cEmailURL,
                cSubmitAs:"XML",
                cCharSet:"utf-8"
    I'll work out the Export to Excel thing later as I've seen many tutorials on that.  But can I do the 3 fields to 1 thing at all?
    Please Help!!!

    Sorry Gilad.  I hope I'm not getting on your nerves (too much) but as I said it's been a while since I did any formal code. And I'm trying to do this code for a work document but I'm doing it in amongst so many other things I do for my job that it's difficult to get the time to concentrate for longer than 5 mins.
    I didn't get a chance to try that code until just now.  I guess I asked again as I thought (from what I'd read) that it wouldn't be that simple.
    So I've added that code and I get no errors.  But it doesn't appear to be doing anything either.  I've added the code like this in the Custom calculation script of a separate field I've called FileName.  And on the Button i'm using I've added:  buttonClick()
    function buttonClick(){
    if(buttonClick==false)
              event.value=this.getField("SURNAME").valueAsString + "-" + this.getField("FIRSTNAME").valueAsString + "-" + this.getField("dob").valueAsString;
    So now I'm guessing that becasue i'm not getting an error or a result that I've screwed it up still.  Have I put the code in the correct area?  Have I assigned a the buttonClick() function correctly?

  • How can I copy text spanning multiple pages in iBook?

    I like to drop sections of text from i
    books into letters, journal entries etc and for the life of me I cannot figure out the functionality of grabbing text that spans multiple pages.

    Hi James,
    Thank you so much for taking the time to help me out.  You actually solved the problem.  I am able to select as much text as I want now.  The bummer is the lame feature where you cannot take more than a couple hundred words at a time.  The section I wanted was about one and a half pages and it took me 3 separate copy pastes to get it all.  Does anyone know of software or a trick to overcome this limitation?
    James thanks again.  I really appreciate your help.

  • How can i print a text message

    how can i print text meaasge's

    you can copy paste it to notes
    or you can take a screenshot and print it that way

  • How can i solve "could not load language and text preference "

    how can i solve " could not load language and text preference ".. help everyone...

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up guest users” (without the quotes) in the search box. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Shut down your computer, wait 30 seconds, and then hold down the shift key while pressing the power button.
    When you see the gray Apple logo, release the shift key.
    If you are prompted to log in, type your password, and then hold down the shift key again as you click Log in.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.  The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode.
    Test while in safe mode. Same problem?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

  • How can I print multiple PDF files at once using Windows 7?

    How can I print multiple PDF files at once, on an HP LJ Pro 400 xcolocr printer without opening each
    one separately using Windows 7?

    I am sorry, but to get your issue more exposure I would suggest posting it in the commercial forums since this is a commercial printer. You can do this at http://h30499.www3.hp.com/hpeb/
    I hope this helps.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • How can I print multiple copies of same photo onto one page on iPhoto 9.5.1?

    How can I print multiple copies of same photo onto one page on iPhoto 9.5.1? I was able to do it on the old iPhoto, but can't seem to be able to do it on the new iPhoto. Grrr...

    Photos does the same thing.... Only workaround I can come up with is to create a template in Pages and copy & paste.

  • Label Printing Using Address Book - How can I Print multiple labels of the same name?

    Label Printing Using Address Book - How can I Print multiple labels of the same name?

    I used to be able to print multiple copies of the same picture on one page using iphoto. There was a customise button when you went through to print and it was there somewhere. I can't see it anymore - maybe since an upgrade.
    It's gone. But as a work-around, duplicate your photo (⌘D) to create as many versions as you want copies and select all at once. Then use the "Custom" print layout and set the photo size you want.
    After printing, trash the added versions.

  • How can I print multiple copies of the same photo onto one sheet of paper?  Do I have to Duplicate the photo in iPhoto and then select them all?

    How can I print multiple copies of the same photo onto one sheet of paper?  Do I have to Duplicate the photo in iPhoto and then select them all?

    no - you simply have to select the option to print mucliples of a photo on a page
    select the photo and go to the file menu ==> print - select the printer, paper size and print size and click customize - in the tool bar click on the settings icon (the gear looking thingy) and select "multiple of the same photo per page" and the preview will reflect this option showing a full page of the selected size photos
    LN

  • How can I print a selection of text?

    In Mail (in Mavericks).  I would like to print just a paragraph or two that I have selected (highlighted).  How can I print just that selected text and not any other text or headers in that email?  I know I can copy and paste the text into a Text Edit document, but I'm looking for a quicker way to print just that selected text without leaving Mail.

    Create an Automator action that gets the selected text and automatically creates the TextEdit document and prints:
    To make the Service, create a New Automator workflow and select Service as the type.
    Set it to receive selected text in any application.
    Drag in a New TextEdit Document action
    Drag in a Run Applescript Action.
    Set the applescript to this:
    on run {input, parameters}
              tell application "TextEdit"
      print document of front window
      close document of front window without saving
      quit
              end tell
              return input
    end run
    Save it as something like Print Selected Text. Then, you can select text, ctrl-click on it, then select Print Selected Text from the Services submenu of the contextual menu.
    Here is a picture of the workflow:
    You could also give it a shortcut in the Keyboard System prefs, Shortcuts tab:

  • How can I print my text message

    End of the year and would like to file my text messages. How can I print, please help? Thanks

    I review the available sms backup applications in the Play Store to see if one meets your needs.

  • How can I print a text message conversation from my iPhone? Not using screenshots.

    How can I print a text message conversation from my iPhone? Not using screenshots. It's around 500 messages so screenshots is not a option.

    Yes, you can delete from iphone:
    http://manuals.info.apple.com/enUS/iPhone_iOS4_UserGuide.pdf
    It is covered in the manual.
    Page 172:
    "Delete a podcast: In the Podcasts list in iPod, swipe left or right over the podcast, then
    tap Delete. "

Maybe you are looking for

  • Mini display port to composite?

    I'm a video DJ and have gotten tired of lugging around 2 DVJs, 2 mixers, and a case of DVDs to my gigs, so I decided to get a MacBook and join the ranks of the laptop DJs.  I'm really starting to regret that decision.  After dropping almost 3 grand o

  • Exchange calendar sync issues among iOS devices and Mavericks

    When I add an event to a shared Exchange calendar on my Mac in iCal, and mark it as All-Day, that designation does not appear with the event on my iOS devices. Instead, it's given a 24-hour duration from 12 to 12, so to speak. Here's the confusing pa

  • How delete a par file?

    Hi, how can i delete a deployed par file? regards, seed

  • Quicktime issues after system restore

    After system restore we had to reinstall games which required quicktime. after which I reinstalled itunes, but it wouldn't install without completely uninstalling everything for quicktime. reinstalled updated quicktime and itunes, but now games aren'

  • What are the temporary files created by Tuxedo 8.1 in /tmp

    Hello there, I've noticed that Tuxedo is storing files into /tmp/tx000XCi002W08 !!?? Does anybody know when and why tuxedo is doing this ? By the way is it possible to move the location of these temporary files somewhere else ? My config infos: - Tux