Printing chinese characters file

Discussions

EJB design: Printing chinese characters file

  1. Printing chinese characters file (2 messages)

    Dear all,
    I want to print a file that contains chinese characters for example (559928 СüI°ü´ü(ìFÃæ) - this is Big5) to a printer, but the ouput is always some funny characters. The character set for this file is Big5. Here is snippet of my code:


    DocFlavor psInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
     
    PrintService[] services =
       PrintServiceLookup.lookupPrintServices(null, null);
     
    DocPrintJob job = services[0].createPrintJob();
     
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
     
    InputStream psStream = new FileInputStream("C:/test.txt");
     
    Doc myDoc = new SimpleDoc(psStream, psInFormat, null);
     
    job.print(myDoc, aset);
     



    Please advise

    Thanks
  2. Printing chinese characters file[ Go to top ]

    Hi,

    Use the File Readers/Writers instead of using the streams. This should work.

    Yetish
    Dear all,I want to print a file that contains chinese characters for example (559928 СüI°ü´ü(ìFÃæ) - this is Big5) to a printer, but the ouput is always some funny characters. The character set for this file is Big5. Here is snippet of my code:DocFlavor psInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE; PrintService[] services =    PrintServiceLookup.lookupPrintServices(null, null); DocPrintJob job = services[0].createPrintJob(); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); InputStream psStream = new FileInputStream("C:/test.txt"); Doc myDoc = new SimpleDoc(psStream, psInFormat, null);  job.print(myDoc, aset); Please adviseThanks
  3. Printing chinese characters file[ Go to top ]

    hi,
    Thanks for replying, unfortunately my printer only support the following DocFlavors, that's why I use InputStream, are there any ways in java for doing this? If not I think I will switch to Microsoft product.

    Alex

    image/gif image [B
    image/gif image java.io.InputStream
    image/gif image java.net.URL
    image/jpeg image [B
    image/jpeg image java.io.InputStream
    image/jpeg image java.net.URL
    image/png image [B
    image/png image java.io.InputStream
    image/png image java.net.URL

    application/x-java-jvm-local-objectref application java.awt.print.Pageable
                                             
    application/x-java-jvm-local-objectref application java.awt.print.Printable

    application/octet-stream application [B
    application/octet-stream application java.net.URL
    application/octet-stream application java.io.InputStream