Printing Unicode By Java

how can i Print out Bengali in java
Programming???????
how can i use Bengali?????

priyankabhar wrote:
I am not sure, it is just a windows system and I am trying to print to the command line. Please suggest me how I can find out if my console supports it.Use the CHCP command to find out what code page your console uses. And as already suggested, Google is a good resource if you don't know what a "code page" is.

Similar Messages

  • Help with code to print HTML in Java 5

    Hi,
    The following code works and runs successfully..
    However, the printing in Java 1.4.2_03 is better than Java 5 (latest version).
    i.e in particular the characters are not monospaced compared with compiling with Java 1.4.2_03. e.g si so ss squashed together.
    This issue does not seem to occur when running the same code in Java 1.4.2_03. (I haven't tried other 1.4.2 java versions).
    Any help would be appreciated. We really need this working under Java 5 or bust.
    Here is the complete listing ... PrintHtml.java (it uses the DocumentRenderer)
    and following this is the input file.
    import javax.swing.text.html.HTMLDocument;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.IOException;
    import java.io.DataInputStream;
    import java.io.InputStream;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    import java.lang.reflect.*;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.Shape;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import javax.swing.JEditorPane;
    import javax.swing.text.Document;
    import javax.swing.text.PlainDocument;
    import javax.swing.text.View;
    import javax.swing.text.html.HTMLDocument;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    import java.text.ParseException;
    public class PrintHtml {
         * Utility helper to convert HTML Text to HTML Document.
         * @param baseUrl URL to be used in order
         * to resolve relative HTML references, in lieu of an
         * HTML BASE tag. May be null, if not required or HTML
         * BASE tag is to be used.
         * @see jbox.view.jfx.JboxHtmlEditor
         * @see jbox.utility.JboxPrint
         * @see jbox.utility.JboxPrintUtil
      public static HTMLDocument htmlTextToHtmlDoc(String htmlText, URL baseUrl)
              try
              //  JboxHtmlEditorKit editorKit = new JboxHtmlEditorKit();
                HTMLEditorKit editorKit = new HTMLEditorKit();
                HTMLDocument doc = (HTMLDocument)editorKit.createDefaultDocument();
                   if (baseUrl != null)
                        try
                             doc.setBase(baseUrl);
                        catch(Exception e)
                             //JboxTraceManager.trace(e);
                   StringReader reader = new StringReader(htmlText);
                   editorKit.read(reader, doc, 0);
             return doc;
              catch(Exception e)
                   //JboxTraceManager.trace(e);
                   return null;
       public static void main(String[] args) {
          System.out.println("printing...");
          HTMLDocument x = new HTMLDocument();
          DocumentRenderer invoice = new DocumentRenderer();
          //invoice.setScaleWidthToFit(false);
          String s = "";
          try {
            BufferedInputStream bis = new BufferedInputStream(new FileInputStream("mark.html"));
            InputStreamReader in = new InputStreamReader(bis , "ASCII");
            StringWriter sw = new StringWriter();
            while (true) {
               int datum = in.read();
               if (datum == -1) break;
               sw.write(datum);
            in.close();
            s = sw.toString();
            System.out.println("s="+s);
          catch (IOException e) {
             System.err.println(e);
          HTMLDocument htmldoc = htmlTextToHtmlDoc(s, null);
          invoice.print(htmldoc);
    // the good old infamous DocumentRenderer.
    /*  Copyright 2002
        Kei G. Gauthier
        Suite 301
        77 Winsor Street
        Ludlow, MA  01056
    class DocumentRenderer implements Printable {
    /*  DocumentRenderer prints objects of type Document. Text attributes, including
        fonts, color, and small icons, will be rendered to a printed page.
        DocumentRenderer computes line breaks, paginates, and performs other
        formatting.
        An HTMLDocument is printed by sending it as an argument to the
        print(HTMLDocument) method. A PlainDocument is printed the same way. Other
        types of documents must be sent in a JEditorPane as an argument to the
        print(JEditorPane) method. Printing Documents in this way will automatically
        display a print dialog.
        As objects which implement the Printable Interface, instances of the
        DocumentRenderer class can also be used as the argument in the setPrintable
        method of the PrinterJob class. Instead of using the print() methods
        detailed above, a programmer may gain access to the formatting capabilities
        of this class without using its print dialog by creating an instance of
        DocumentRenderer and setting the document to be printed with the
        setDocument() or setJEditorPane(). The Document may then be printed by
        setting the instance of DocumentRenderer in any PrinterJob.
      protected int currentPage = -1;               //Used to keep track of when
                                                    //the page to print changes.
      protected JEditorPane jeditorPane;            //Container to hold the
                                                    //Document. This object will
                                                    //be used to lay out the
                                                    //Document for printing.
      protected double pageEndY = 0;                //Location of the current page
                                                    //end.
      protected double pageStartY = 0;              //Location of the current page
                                                    //start.
      protected boolean scaleWidthToFit = true;     //boolean to allow control over
                                                    //whether pages too wide to fit
                                                    //on a page will be scaled.
    /*    The DocumentRenderer class uses pFormat and pJob in its methods. Note
          that pFormat is not the variable name used by the print method of the
          DocumentRenderer. Although it would always be expected to reference the
          pFormat object, the print method gets its PageFormat as an argument.
      protected PageFormat pFormat;
      protected PrinterJob pJob;
    /*  The constructor initializes the pFormat and PJob variables.
      public DocumentRenderer() {
        pFormat = new PageFormat();
        pJob = PrinterJob.getPrinterJob();
    /*  Method to get the current Document
      public Document getDocument() {
        if (jeditorPane != null) return jeditorPane.getDocument();
        else return null;
    /*  Method to get the current choice the width scaling option.
      public boolean getScaleWidthToFit() {
        return scaleWidthToFit;
    /*  pageDialog() displays a page setup dialog.
      public void pageDialog() {
        pFormat = pJob.pageDialog(pFormat);
    /*  The print method implements the Printable interface. Although Printables
        may be called to render a page more than once, each page is painted in
        order. We may, therefore, keep track of changes in the page being rendered
        by setting the currentPage variable to equal the pageIndex, and then
        comparing these variables on subsequent calls to this method. When the two
        variables match, it means that the page is being rendered for the second or
        third time. When the currentPage differs from the pageIndex, a new page is
        being requested.
        The highlights of the process used print a page are as follows:
        I.    The Graphics object is cast to a Graphics2D object to allow for
              scaling.
        II.   The JEditorPane is laid out using the width of a printable page.
              This will handle line breaks. If the JEditorPane cannot be sized at
              the width of the graphics clip, scaling will be allowed.
        III.  The root view of the JEditorPane is obtained. By examining this root
              view and all of its children, printView will be able to determine
              the location of each printable element of the document.
        IV.   If the scaleWidthToFit option is chosen, a scaling ratio is
              determined, and the graphics2D object is scaled.
        V.    The Graphics2D object is clipped to the size of the printable page.
        VI.   currentPage is checked to see if this is a new page to render. If so,
              pageStartY and pageEndY are reset.
        VII.  To match the coordinates of the printable clip of graphics2D and the
              allocation rectangle which will be used to lay out the views,
              graphics2D is translated to begin at the printable X and Y
              coordinates of the graphics clip.
        VIII. An allocation Rectangle is created to represent the layout of the
              Views.
              The Printable Interface always prints the area indexed by reference
              to the Graphics object. For instance, with a standard 8.5 x 11 inch
              page with 1 inch margins the rectangle X = 72, Y = 72, Width = 468,
              and Height = 648, the area 72, 72, 468, 648 will be painted regardless
              of which page is actually being printed.
              To align the allocation Rectangle with the graphics2D object two
              things are done. The first step is to translate the X and Y
              coordinates of the graphics2D object to begin at the X and Y
              coordinates of the printable clip, see step VII. Next, when printing
              other than the first page, the allocation rectangle must start laying
              out in coordinates represented by negative numbers. After page one,
              the beginning of the allocation is started at minus the page end of
              the prior page. This moves the part which has already been rendered to
              before the printable clip of the graphics2D object.
        X.    The printView method is called to paint the page. Its return value
              will indicate if a page has been rendered.
        Although public, print should not ordinarily be called by programs other
        than PrinterJob.
      public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) {
        double scale = 1.0;
        Graphics2D graphics2D;
        View rootView;
    //  I
        graphics2D = (Graphics2D) graphics;
        disableDoubleBuffering(jeditorPane);
    //  II
        jeditorPane.setSize((int) pageFormat.getImageableWidth(),Integer.MAX_VALUE);
        jeditorPane.validate();
    //  III
        rootView = jeditorPane.getUI().getRootView(jeditorPane);
    //  IV
        if ((scaleWidthToFit) && (jeditorPane.getMinimumSize().getWidth() >
        pageFormat.getImageableWidth())) {
          scale = pageFormat.getImageableWidth()/
          jeditorPane.getMinimumSize().getWidth();
          graphics2D.scale(scale,scale);
    //  V
        graphics2D.setClip((int) (pageFormat.getImageableX()/scale),
        (int) (pageFormat.getImageableY()/scale),
        (int) (pageFormat.getImageableWidth()/scale),
        (int) (pageFormat.getImageableHeight()/scale));
    //  VI
        if (pageIndex > currentPage) {
          currentPage = pageIndex;
          pageStartY += pageEndY;
          pageEndY = graphics2D.getClipBounds().getHeight();
    //  VII
        graphics2D.translate(graphics2D.getClipBounds().getX(),
        graphics2D.getClipBounds().getY());
    //  VIII
        Rectangle allocation = new Rectangle(0,
        (int) -pageStartY,
        (int) (jeditorPane.getMinimumSize().getWidth()),
        (int) (jeditorPane.getPreferredSize().getHeight()));
    //  X
        if (printView(graphics2D,allocation,rootView)) {
          return Printable.PAGE_EXISTS;
        else {
          pageStartY = 0;
          pageEndY = 0;
          currentPage = -1;
          return Printable.NO_SUCH_PAGE;
      /** The speed and quality of printing suffers dramatically if
       *  any of the containers have double buffering turned on.
       *  So this turns if off globally.
       *  @see enableDoubleBuffering
      public static void disableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(false);
      /** Re-enables double buffering globally. */
      public static void enableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(true);
    /*  print(HTMLDocument) is called to set an HTMLDocument for printing.
      public void print(HTMLDocument htmlDocument) {
        setDocument(htmlDocument);
        printDialog();
    /*  print(JEditorPane) prints a Document contained within a JEDitorPane.
      public void print(JEditorPane jedPane) {
        setDocument(jedPane);
        printDialog();
    /*  print(PlainDocument) is called to set a PlainDocument for printing.
      public void print(PlainDocument plainDocument) {
        setDocument(plainDocument);
        printDialog();
    /*  A protected method, printDialog(), displays the print dialog and initiates
        printing in response to user input.
      protected void printDialog() {
        if (pJob.printDialog()) {
          pJob.setPrintable(this,pFormat);
          try {
            pJob.print();
          catch (PrinterException printerException) {
            pageStartY = 0;
            pageEndY = 0;
            currentPage = -1;
            System.out.println("Error Printing Document");
    /*  printView is a recursive method which iterates through the tree structure
        of the view sent to it. If the view sent to printView is a branch view,
        that is one with children, the method calls itself on each of these
        children. If the view is a leaf view, that is a view without children which
        represents an actual piece of text to be painted, printView attempts to
        render the view to the Graphics2D object.
        I.    When any view starts after the beginning of the current printable
              page, this means that there are pages to print and the method sets
              pageExists to true.
        II.   When a leaf view is taller than the printable area of a page, it
              cannot, of course, be broken down to fit a single page. Such a View
              will be printed whenever it intersects with the Graphics2D clip.
        III.  If a leaf view intersects the printable area of the graphics clip and
              fits vertically within the printable area, it will be rendered.
        IV.   If a leaf view does not exceed the printable area of a page but does
              not fit vertically within the Graphics2D clip of the current page, the
              method records that this page should end at the start of the view.
              This information is stored in pageEndY.
      protected boolean printView(Graphics2D graphics2D, Shape allocation,
      View view) {
        boolean pageExists = false;
        Rectangle clipRectangle = graphics2D.getClipBounds();
        Shape childAllocation;
        View childView;
        if (view.getViewCount() > 0 &&
              !view.getElement().getName().equalsIgnoreCase("td")) {
          for (int i = 0; i < view.getViewCount(); i++) {
            childAllocation = view.getChildAllocation(i,allocation);
            if (childAllocation != null) {
              childView = view.getView(i);
              if (printView(graphics2D,childAllocation,childView)) {
                pageExists = true;
        } else {
    //  I
          if (allocation.getBounds().getMaxY() >= clipRectangle.getY()) {
            pageExists = true;
    //  II
            if ((allocation.getBounds().getHeight() > clipRectangle.getHeight()) &&
            (allocation.intersects(clipRectangle))) {
              view.paint(graphics2D,allocation);
            } else {
    //  III
              if (allocation.getBounds().getY() >= clipRectangle.getY()) {
                if (allocation.getBounds().getMaxY() <= clipRectangle.getMaxY()) {
                  view.paint(graphics2D,allocation);
                } else {
    //  IV
                  if (allocation.getBounds().getY() < pageEndY) {
                    pageEndY = allocation.getBounds().getY();
        return pageExists;
    /*  Method to set the content type the JEditorPane.
      protected void setContentType(String type) {
        jeditorPane.setContentType(type);
    /*  Method to set an HTMLDocument as the Document to print.
      public void setDocument(HTMLDocument htmlDocument) {
        jeditorPane = new JEditorPane();
        setDocument("text/html",htmlDocument);
    /*  Method to set the Document to print as the one contained in a JEditorPane.
        This method is useful when Java does not provide direct access to a
        particular Document type, such as a Rich Text Format document. With this
        method such a document can be sent to the DocumentRenderer class enclosed
        in a JEditorPane.
      public void setDocument(JEditorPane jedPane) {
        jeditorPane = new JEditorPane();
        setDocument(jedPane.getContentType(),jedPane.getDocument());
    /*  Method to set a PlainDocument as the Document to print.
      public void setDocument(PlainDocument plainDocument) {
        jeditorPane = new JEditorPane();
        setDocument("text/plain",plainDocument);
    /*  Method to set the content type and document of the JEditorPane.
      protected void setDocument(String type, Document document) {
        setContentType(type);
        jeditorPane.setDocument(document);
    /*  Method to set the current choice of the width scaling option.
      public void setScaleWidthToFit(boolean scaleWidth) {
        scaleWidthToFit = scaleWidth;
    }The sample input file is "mark.html":::
    <html>
    <head>
    <style type="text/css">
    <!--
    ol { list-style-type: decimal; margin-top: 10; margin-left: 50; margin-bottom: 10 }
    u { text-decoration: underline }
    s { text-decoration: line-through }
    p { font-weight: normal; font-size: medium; margin-top: 15 }
    dd p { margin-top: 0; margin-left: 40; margin-bottom: 0 }
    ol li p { margin-top: 0; margin-bottom: 0 }
    address { color: blue; font-style: italic }
    i { font-style: italic }
    h6 { font-weight: bold; font-size: xx-small; margin-top: 10; margin-bottom: 10 }
    h5 { font-weight: bold; font-size: x-small; margin-top: 10; margin-bottom: 10 }
    h4 { font-weight: bold; font-size: small; margin-top: 10; margin-bottom: 10 }
    h3 { font-weight: bold; font-size: medium; margin-top: 10; margin-bottom: 10 }
    dir li p { margin-top: 0; margin-bottom: 0 }
    h2 { font-weight: bold; font-size: large; margin-top: 10; margin-bottom: 10 }
    b { font-weight: bold }
    h1 { font-weight: bold; font-size: x-large; margin-top: 10; margin-bottom: 10 }
    a { color: blue; text-decoration: underline }
    ul li ul li ul li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    menu { margin-top: 10; margin-left: 40; margin-bottom: 10 }
    menu li p { margin-top: 0; margin-bottom: 0 }
    table table { border-color: Gray; margin-right: 0; border-style: outset; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    sup { vertical-align: sup }
    body { margin-right: 0; font-size: 14pt; font-family: SansSerif; color: black; margin-left: 0 }
    ul li ul li ul { list-style-type: square; margin-left: 25 }
    blockquote { margin-right: 35; margin-top: 5; margin-left: 35; margin-bottom: 5 }
    samp { font-size: small; font-family: Monospaced }
    cite { font-style: italic }
    sub { vertical-align: sub }
    em { font-style: italic }
    table table table { border-color: Gray; margin-right: 0; border-style: outset; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    ul li p { margin-top: 0; margin-bottom: 0 }
    ul li ul li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    var { font-weight: bold; font-style: italic }
    table { border-color: Gray; margin-right: 7; border-style: outset; margin-top: 7; margin-left: 7; margin-bottom: 17 }
    dfn { font-style: italic }
    menu li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    strong { font-weight: bold }
    ul { list-style-type: disc; margin-top: 10; margin-left: 50; margin-bottom: 10 }
    center { text-align: center }
    ul li ul { list-style-type: circle; margin-left: 25 }
    kbd { font-size: small; font-family: Monospaced }
    dir li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    th p { font-weight: bold; padding-left: 2; padding-bottom: 3; padding-right: 2; margin-top: 0; padding-top: 3 }
    ul li menu { list-style-type: circle; margin-left: 25 }
    dt { margin-top: 0; margin-bottom: 0 }
    ol li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    li p { margin-top: 0; margin-bottom: 0 }
    strike { text-decoration: line-through }
    dl { margin-top: 10; margin-left: 10; margin-bottom: 10 }
    tt { font-family: Monospaced }
    ul li { margin-right: 0; margin-top: 0; margin-left: 0; margin-bottom: 0 }
    dir { margin-top: 10; margin-left: 40; margin-bottom: 10 }
    pre p { margin-top: 0 }
    th { border-color: Gray; border-style: solid; padding-left: 3; padding-bottom: 3; padding-right: 1; padding-top: 1 }
    pre { font-family: Monospaced; margin-top: 5; margin-bottom: 5 }
    td { border-color: Gray; border-style: inset; padding-left: 3; padding-bottom: 3; padding-right: 1; padding-top: 1 }
    td p { padding-left: 2; padding-bottom: 3; padding-right: 2; margin-top: 0; padding-top: 3 }
    code { font-size: small; font-family: Monospaced }
    small { font-size: x-small }
    big { font-size: x-large }
    -->
    </style>
    </head>
    <body>
    <p style="margin-top: 0">
    </p>
    <table width="500" cellspacing="20" border="1">
    <tr>
    <td height="330" valign="top">
    <table border="0">
    <tr>
    <td>
    <font size="2">This is to certify that [[Client Name]], born
    on [[Client Date of Birth]], of [[Client Residential
                    Address]], was the holder of motor vehicle driver
    licence number [[Client Licence Number]], first issued on
    [[First Issue Date of Holding]] and expired on [[Holding
                    Expiry Date]].<br></font>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <table width="500" border="2">
    <tr>
    <td>
    <table width="480" border="0">
    <tr>
    <td align="right">
    <font size="2"><br>
    <b>Fred Flintstone<br>Manager</b><br>Records Services Division<br>State
    Police<br>An authorised person for the purposes of the
    Road Act 1986</font>
    </td>
    </tr>
    <tr>
    <td align="left">
    <font size="2"><b>User ID: wzvqv7<br>Dated: 29 November 2006</b>
    </font>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>

    I have finally cracked it!!!!!!!!!!!!!!!!
    The issue is definitely with Java Sun. "Uneven character spacing when printing JTextComponent"
    It is raised on the http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6488219
    And currently in OPEN state, and raised on 31 Oct 2006 and mentions it was caused by fix 4352983.
    So where do we go from here. It's not good because I have tried all later version of the JVM and the issue is still there.
    Why? Because it hasn't been fixed yet. Read the bug report above, as it gives more insight -- and mentions the workaround is NOT good for existing code.
    So the way forward is to use an earlier version of the JVM 5.
    I download the JVM version 1.5.0 (starting version) and works Ok... I would probably think version prior to 4352983 would be Ok too.
    Please vote for this.... We have a workaround (use older version of the JVM).
    So I am very happy.

  • How to print "Text" in JAVA(TM)....

    Does anyone know how to print "text" using Java?
    - Here's an example output...
    NOTE: # == 'empty spaces'
    --------------------------- <- Paper
    |###################|
    |####Welcome#########|
    |###################|
    |########to##########|
    |###########JAVA(TM)##|
    |###################|
    |#######Programming####|
    |###################|
    Please post a complete << SAMPLE CODE >> for printing the "text" (Welcome to JAVA(TM) Programming. Including the indentions. So it will not be like this...
    -------------------- <- Paper
    |Welcome |
    |to |
    |JAVA(TM) |
    |Programming |
    | |
    | |
    | |
    | |
    Thanks.

    Please read How To Ask Questions The Smart Way

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader.

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader.
    For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer.
    "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>".
    Current Situation: The above command line parameter when executed is working as expected in a User's Workspace.
    When executed in a command line on the Application Server, it is working as expected.
    But, the same is not working while executing it from Deployed environment.
    Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2.
    Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer."C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>". Current Situation: The above command line parameter when executed is working as expected in a User's Workspace. When executed in a command line on the Application Server is working as expected. But, the same is not working while executing it from Deployed environment.Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2. Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

  • Printing a PDF Object to Label printer from AS Java

    Hello,
    at the moment I am looking at a requirement to print from a Java application in a standalone single stack AS Java installation. Currently I would like to use the Adobe Document Services to print to a label printer (e.g. Zebra). This should all be done on the server side.
    What I've found that there are hints how to do that using a FM in the ABAP stack. But a ABAP Stack is not available.
    Any hints would be appreciated.
    Kind Regards,
    Christoph Mertins
    Edited by: Christoph Mertins on Apr 28, 2010 3:45 PM

    Have you checked to see if the "Print As Image" option is inadvertently checked? In the Print dialog, click the Advanced button then look for the checkbox.

  • Monitor Print Queue with java program

    I'm plan to write a client/server based application which control the printing for every user. I've no idea how to start on the application.
    1. Is it possible to monitor the print queue or print job using java application?
    2. How does the server react if the client sending the print job to there? How's the client can trigger the signal during printing and send to the server?
    Thank you!

    I'm plan to write a client/server based application
    which control the printing for every user. I've no
    idea how to start on the application.You should establish feasibility first, before planning to write anything
    1. Is it possible to monitor the print queue or print
    job using java application?Not really. Print queues are highly system-dependent things and some e.g. Windows can really only be accessed via system calls in a native language.
    2. How does the server react if the client sending
    the print job to there?Err, it prints the file?
    How's the client can trigger the signal during printing and send to the server? What signal?
    But I suspect the answer to the first question makes the others irrelevant.

  • How to control the printing resolution in JAVA

    Do we have any control on printing resolution in JAVA?
    If yes, how?
    Because I can print out the component but its resolution is same as screen or even less.

    Hi,
    Maybe you have to be more explicit. What do you want to print? What Component? Only a image? A Swing component (JTree, JTable, JPanel, etc)?

  • Funtion is returning jstring, how to print it in java code

    Plz let me know how to print a jstirng which is returning by a native function in java.
    When i use System.out.print(view());
    it gives me error.
    what i shoulr do with jsting so that i can use/print it in java.

    dscdscWhat do you mean by that?

  • Printing chinese w/ Java Print Service API become garbled characters

    I'm using XP platform and I've a plain text file on my drive.
    Now, what I want to do is, to read the text file in, then print it, that's all.
    However, the printout become messy, just some garbled characters.
    I did try to change quite a different ways to read the file, but the printout is still messy.
    Is there anything wrong? Can somebody give me a help?
    package com.ysf.document.client.ups;
    import java.io.FileReader;
    import java.io.IOException;
    import javax.print.*;
    import javax.print.attribute.*;
    public class Class1
       public static void main(String[] args)
          String filename = "c:\\temp\\abcd.txt";
          DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
          PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
          // locate a print service that can handle it
          PrintService[] pservices = PrintServiceLookup.lookupPrintServices(flavor, aset);
          // create a print job for the chosen service
          int printnbr = 1;
          DocPrintJob pj = pservices[printnbr].createPrintJob();
          try
             int c;
             FileReader f = new FileReader(filename);
             StringBuffer buffer = new StringBuffer();
             c = f.read();
             while (c != -1)
                buffer.append((char) c);
                c = f.read();
             Doc doc = new SimpleDoc(buffer.toString().getBytes("BIG5"), flavor, null);
             pj.print(doc, aset);
          } catch (IOException ie)
             System.err.println(ie);
          } catch (PrintException e)
             System.err.println(e);
    }

    For #1, indeed, it's my overlook, I've corrected it already.
    For #2, it shows, java.lang.ArrayIndexOutOfBoundsException: 1.
    It's mainly because my printer do not support this flavor.
    My printer supports only:
    image/gif
    [B OR java.io.InputStream OR java.net.URL
    image/jpeg
    [B OR java.io.InputStream java.net.URL
    image/png
    [B OR java.io.InputStream OR java.net.URL
    application/x-java-jvm-local-objectref
    java.awt.print.Pageable OR java.awt.print.Printable
    application/octet-stream
    [B OR java.net.URL OR java.io.InputStream
    Up to now, still no solution to it. Anybody help.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Print documents using java

    hai,
    how can print the text(.txt) file or some message to the printer using Java?
    pls answer it.

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.print.Printable;
    import java.awt.print.*;
    import javax.swing.*;
    import java.awt.Graphics;
    import java.text.*;
    import java.awt.geom.Point2D;
    import java.awt.font.LineBreakMeasurer;
    import java.awt.font.TextLayout;
    import java.util.Vector;
    public class Print implements Printable {
    private AttributedString mStyledText = null;
    private Vector msg = new Vector();
    public Print( Vector msg ) {
    this.msg = msg;
    public int print(Graphics g, PageFormat format, int pageIndex) {
    Graphics2D g2d = (Graphics2D) g;
    /* Move the origin from the corner of the Paper to the corner
    * of the imageable area.
    g2d.translate(format.getImageableX(),format.getImageableY());
    /* Set the text color.
    g2d.setPaint(Color.black);
    /* Use a LineBreakMeasurer instance to break our text into
    * lines that fit the imageable area of the page.
    Point2D.Float pen = new Point2D.Float();
    for ( int i = 0; i < msg.size(); i++ ) {
    mStyledText = new AttributedString((String)msg.get( i ) );
    AttributedCharacterIterator charIterator =mStyledText.getIterator();
    LineBreakMeasurer measurer = new LineBreakMeasurer(charIterator, g2d.getFontRenderContext());
    float wrappingWidth = (float)format.getImageableWidth();
    while (measurer.getPosition() <charIterator.getEndIndex()) {
    TextLayout layout = measurer.nextLayout(wrappingWidth );
    pen.y += layout.getAscent();
    float dx = layout.isLeftToRight() ? 0 :(wrappingWidth - layout.getAdvance());
    layout.draw(g2d, pen.x + dx, pen.y);
    pen.y += layout.getDescent() +layout.getLeading();
    if ( pageIndex > 0 ) {
    return this.NO_SUCH_PAGE;
    }else {
    return this.PAGE_EXISTS;
    try this class. the msg Vector contains the text lines that you would like to print.
    Hope this helps.

  • Browser printing setting in Java

    Hello!
    I want to have following browser printing setting using java.
    (1)     Page Size
    (2)     Page Margins
    (3)     Page Orientation
    (4)     Default Printer
    How can I get those?
    Regards,
    Chetan

    But is it possible to get those info via JavaScript?Probably. Google will tell. Here is how to use it.
    Type http://www.google.com into your browser's address bar and hit enter. (then bookmark the page, it is very useful)
    Type in some keywords related to your question. An example migh be "Javascript print page setup" or something like that. Then hit the search button.
    Browse through the links for any suitable pages that may answer your question.
    If you do not find a suitable answer, maybe look through those links to find a Javascript forum where you can ask the question to people more likely to know.

  • Printing unicode characters in Java - help

    Hi there,
    I want to print out unicode characters through java programming language in windows system. For example, I want to print Devanagari characters. I found out that '\u0900' to '\u0975' represent devanagari characters. So I tried following,
    out = new PrintStream(System.out, true, "UTF-8");
    out.println('\u0911');
    but they print characters like ��� and not the actual devanagari characters. Just to be more clear, devanagari script is used by Hindi, Nepali and similar languages.
    If you knew about it and could give any suggestions, that would be very helpful.
    Thanks in advance!

    priyankabhar wrote:
    I am not sure, it is just a windows system and I am trying to print to the command line. Please suggest me how I can find out if my console supports it.Use the CHCP command to find out what code page your console uses. And as already suggested, Google is a good resource if you don't know what a "code page" is.

  • Printing unicode from an xml file

    I have a unicode character in an xml file
    say
    < item name="Notification" value="hi amigo\u0041" />
    When I parse this file and try to print out the String value I get the follwoing output
    hi amigo\u0041
    Thoug what I expected was
    hi amigoA
    any idea what am I doing wrong or what am I missing?
    any help would be greatly appreciated.

    Yep I tried that too.
    if I try it with ) I get
    java.lang.reflect.InvocationTargetException:
    org.xml.sax.SAXException: **Parsing Fatal Error**
    Line: 38
    URI: file:C:/opt/config/mmcpSpecific.conf
    Message: Illegal decimal character reference.
    at
    configuration.ConfigParser$ConfigErrorHandler.fatalErr
    r(ConfigParser.java:1005)
    at
    org.apache.crimson.parser.Parser2.fatal(Parser2.java:3
    38)
    at
    org.apache.crimson.parser.Parser2.fatal(Parser2.java:3
    23)
    at
    org.apache.crimson.parser.Parser2.parseCharNumber(Pars
    r2.java:2327)
    at
    org.apache.crimson.parser.Parser2.parseLiteral(Parser2
    java:730)
    at
    org.apache.crimson.parser.Parser2.maybeElement(Parser2
    java:1375)Nope as the doctor mentioned you are not doing it the right way
    < item name="Notification" value="hi amigo\u0041" />
    instead of this you should use
    < item name="Notification" value="hi amigo&#0041;" />
    you would not get the exception if you dont miss the semi colon. I guess you must have been missing that
    < item name="Notification" value="hi amigo&#0041;" />

  • Unicode and Java

    Hi
    As we all know Java treat character literals as Unicode characters. I have been studying Unicode and the way they treat characters and I have a doubt which is not specific to Java code but specific to Unicode.
    Unicode states that each character is assigned a number which is unique, this number is called code point.
    The relationship between characters and code points is 1:1.
    Eg: the String *"hello"* (which is sequence of character literals) can be represent by the following Code Points
    *\u0065 \u0048 \u006c \u006c \u006f*
    I also read that a certain character code point must be recognized by a specific encoding or else a question mark (?) is output in place of the character. Not all code points can be recognized by an encoding.
    So, the letter *&#1500;* would not be recognized by all encodings and should be replaced by a question mark (?) right?
    The interesting is that this code point represents a different character and not a *"?"* in other encodings. It should print the same character
    This is the HTML code I used for tests (save it in your hard disk and open using your navigator, then select the following encodings: UTF16, ISO-8859-1)
    <html>
    <body>
    &#1502;&#1506;&#1497;&#1500; &#1488;&#1495;&#1491; &#1489;&#1490;&#1513;&#1501;, &#1500;&#1497;&#1500;&#1492; &#1513;&#1500; &#1488;&#1508;&#1512;&#1497;&#1500;
    &#1504;&#1508;&#1514;&#1495; &#1499;&#1502;&#1493; &#1506;&#1504;&#1503;, &#1493;&#1512;&#1506;&#1501; &#1488;&#1494; &#1502;&#1488;&#1497;&#1512;
    &#1502;&#1506;&#1497;&#1500; &#1488;&#1495;&#1491; &#1489;&#1490;&#1513;&#1501;, &#1500;&#1497;&#1500;&#1492; &#1495;&#1501; &#1493;&#1511;&#1512;
    &#1504;&#1508;&#1512;&#1505; &#1499;&#1502;&#1493; &#1495;&#1493;&#1508;&#1492;, &#1493;&#1502;&#1514;&#1495;&#1514; &#1488;&#1504;&#1497; &#1513;&#1512;
    &#1502;&#1506;&#1497;&#1500; &#1488;&#1495;&#1491; &#1489;&#1490;&#1513;&#1501;, &#1512;&#1496;&#1493;&#1489;, &#1500;&#1502;&#1497; &#1488;&#1499;&#1508;&#1514;
    &#1488;&#1504;&#1497; &#1500;&#1488; &#1506;&#1500; &#1492;&#1488;&#1512;&#1509;, &#1488;&#1497;&#1514;&#1498; &#1500;&#1502;&#1506;&#1500;&#1492; &#1513;&#1496;
    &#1512;&#1493;&#1495; &#1489;&#1508;&#1504;&#1497;&#1501;, &#1496;&#1497;&#1508;&#1493;&#1514; &#1492;&#1490;&#1513;&#1501; &#1492;&#1488;&#1495;&#1512;&#1493;&#1504;&#1493;&#1514;
    &#1504;&#1493;&#1490;&#1506;&#1493;&#1514; &#1489;&#1500;&#1495;&#1497;&#1497;&#1501;, &#1489;&#1508;&#1504;&#1497;&#1497;&#1498; &#1502;&#1513;&#1495;&#1511;&#1493;&#1514;
    &#1488;&#1502;&#1510;&#1506; &#1492;&#1512;&#1495;&#1493;&#1489;, &#1499;&#1493;&#1500;&#1501; &#1499;&#1489;&#1512; &#1497;&#1513;&#1504;&#1497;&#1501;
    &#1492;&#1497;&#1497;&#1514;&#1492; &#1506;&#1491;&#1492; &#1492;&#1512;&#1493;&#1495; &#1493;&#1506;&#1493;&#1491; &#1513;&#1504;&#1497; &#1499;&#1493;&#1499;&#1489;&#1497;&#1501;
    &#1488;&#1502;&#1510;&#1506; &#1492;&#1512;&#1495;&#1493;&#1489;, &#1499;&#1493;&#1500;&#1501; &#1499;&#1489;&#1512; &#1497;&#1513;&#1504;&#1497;&#1501;,
    &#1492;&#1497;&#1497;&#1514;&#1492; &#1506;&#1491;&#1492; &#1492;&#1512;&#1493;&#1495; &#1493;&#1506;&#1493;&#1491; &#1513;&#1504;&#1497; &#1499;&#1493;&#1499;&#1489;&#1497;&#1501;
    &#1512;&#1488;&#1497;&#1514;&#1497; &#1494;&#1493;&#1490; &#1506;&#1497;&#1504;&#1497;&#1497;&#1501;, &#1502;&#1505;&#1512;&#1489;&#1493;&#1514; &#1500;&#1492;&#1497;&#1508;&#1514;&#1495;
    &#1510;&#1493;&#1500;&#1500;&#1514; &#1488;&#1500; &#1506;&#1510;&#1502;&#1498; &#1506;&#1502;&#1493;&#1511; &#1489;&#1497;&#1501; &#1513;&#1500;&#1498;,
    &#1502;&#1491;&#1497; &#1508;&#1506;&#1501; &#1488;&#1514; &#1506;&#1493;&#1500;&#1492;, &#1500;&#1493;&#1511;&#1495;&#1514; &#1511;&#1510;&#1514; &#1488;&#1493;&#1497;&#1512;
    &#1500;&#1488; &#1512;&#1493;&#1510;&#1492; &#1500;&#1492;&#1497;&#1505;&#1495;&#1507;, &#1502;&#1499;&#1497;&#1512;&#1492; &#1488;&#1514; &#1492;&#1502;&#1495;&#1497;&#1512;
    &#1488;&#1502;&#1510;&#1506; &#1492;&#1512;&#1495;&#1493;&#1489;, &#1499;&#1493;&#1500;&#1501; &#1499;&#1489;&#1512; &#1497;&#1513;&#1504;&#1497;&#1501;...
    </body>
    </html>I would appreciate if you correct me in case I am wrong!
    Edited by: charllescuba1008 on Mar 31, 2009 2:08 PM

    charllescuba1008 wrote:
    Unicode states that each character is assigned a number which is unique, this number is called code point. Right.
    The relationship between characters and code points is 1:1.Uhm .... let's assume "yes" for the moment. (Note that the relationship between the Java type char and code point is not 1:1 and there are other exceptions ...)
    Eg: the String *"hello"* (which is sequence of character literals) can be represent by the following Code Points
    *\u0065 \u0048 \u006c \u006c \u006f*Those are the Java String unicode escapes. If you want to talk about Unicode Codepoints, then the correct notation for "Hello" would be
    U+0048 U+0065 U+006C U+006C U+006F
    Note that you swapped the H and e.
    I also read that a certain character code point must be recognized by a specific encoding or else a question mark (?) is output in place of the character.This one is Java specific. If Java tries to translate some unicode character to bytes using some encoding that doesn't support that character then it will output the byte(s) for "?" instead.
    Not all code points can be recognized by an encoding.Some encodings (such as UTF-8) can encode all codepoints, others (such as ISO-8859-*, EBCDIC or UCS-2) can not.
    So, the letter *&#1500;* would not be recognized by all encodings and should be replaced by a question mark (?) right?Only in a very specific case in Java. This is not a genral Unicode-level rule.
    (disclaimer: the HTML code presented was using decimal XML entities to represent the unicode characters).
    What you are seing is possibly the replacement character that your text rendering system uses to represent characters that it knows, but can't display (possibly because the current font has no character for them).

Maybe you are looking for

  • FA Acquisition - 21151: error while posting asset document: '100000006'

    Hi All, When I was performing the FA Acquisition for a fixed asset code, the above error message prompt. I am using SAP B1 8.8 PL 15. Before this error appear, I was able to perform all other transactions like FA Acq, Credit Note, Retirement and depr

  • How do i pass parameters to a web dynpro application ?

    Hi all, how do i best possible pass (serverspecific) parameters to a web dynpro application ? i wrote a web dynpro application that, among other things, sends an email and stores files on a server directory. Therefor i need parameters like e.g. "mail

  • Convert Internal tabel to pdf and send email

    Hi all, I have report in internal table and I need to email this report as an pdf attchment. It need not to be pdf file, can be any format but printer friendly. I am using function module SO_NEW_DOCUMENT_ATT_SEND_API1 but not able to send report as p

  • Need help joining shared photo stream

    I got invited to a shared photo stream from an Apple user on my PC.  I am currently signed into an active iCloud account, but everytime I click on the invitation link, it takes me to a page that gives directions on how to join a shared photo stream,

  • HT1711 ITUNES WONT PLAY ANYTHING ***????

    ITUNES WONT PLAY ANYTHING ***??????? HELP MUSIC WITHDRAWAL ARE I