Java Print Service - PDF

I want to use the Java Print Service(JPS) API to programatically send
PDF files to a printer. I need to send these files to the printer
without any user intervention.
At present i am trying to print on HP Laserjet 5100 series.
I am able to print text files,Images (Jpeg) but have not been successfull in printing
PDF files.
DocFlavor flavor = DocFlavor.INPUT_STREAM.PDF;
DocFlavor flavor =new DocFlavor("application/pdf", "java.io.InputStream");
The error I recieve is "Invalid Flavor". I have tried sending the PDF to the
printer using a Document Flavor of INPUT_STREAM.AUTOSENSE.
I also tried with
DocFlavor flavor =new DocFlavor("application/octet-stream", "java.io.InputStream");
When I do
this the PDF file gets sent to the printer but what actually gets
printed is garbage (control characters, overtyping, etc...).
It appears the printer does not directly support PDF printing. The
interesting thing is that I if I bring up a PDF file using Adobe Reader
and press the Print button the file does get printed successfully!
Can someone help me explain why Adobe Reader can print the file
successfully but I am unable to do it programattically? Can someone
suggest a different approach to take?.
Regards,
Raghu

I suspect that it is because Adobe Reader isn't trying to print using the printer's non-existent PDF support. It is probably just sending generic image data to the printer as you would if you were printing Java 2D graphics using JPS.
- Tomas

Similar Messages

  • Java Print Service - PDF Printing

    Hi ,
    I dont get any help on docs why PDF is not working on my local printer.
    I have searched forums and found many people facing this problem.
    I have also tried setting up printer and my java environment on same windows XP system and continues to get invalid flavour error.
    DocFlavor flavor =new DocFlavor("application/pdf", "java.io.InputStream");
    DocFlavor flavor = DocFlavor.INPUT_STREAM.PDF;
    Still i get some strange characters for DocFlavor.INPUT_STREAM.AUTOSENSE docflavor.
    Could you please suggest how to resolve the issue.
    Regards,
    Raghu

    java.awt.print.PrinterJob has setJobName(String jobName) method
    HTH
    Mike

  • Printing HTML with Java Printing Service(JDK1.4 beta)

    Hi there!
    I'm currently checking out the new Java Printing Service (JPS) in the new JDK1.4 beta. This looks like a very promising printing API, with amongst others printer discovery and support for MIME types - but I have some problems with printing HTML displayed in a JEditorPane.
    I'm developing an application that should let the user edit a (HTML)document displayed in a JEditorPane and the print this document to a printer. I have understood that this should be peace-of-cake using the JPS which has pre-defined HTML DocFlavor amongst others, in fact here is what Eric Armstrong says on Javaworld (http://www.javaworld.com/javaone01/j1-01-coolapis.html):
    "With JPS, data formats are specified using MIME types, for example: image/jpeg, text/plain, and text/html. Even better, the API includes a formatting engine that understands HTML, and an engine that, given a document that implements the Printable or Pageable interface, generates PostScript. The HTML formatting engine looks particularly valuable given the prevalence of XML data storage. You only need to set up an XSLT (eXtensible Stylesheet Language Transformation) stylesheet, use it to convert the XML data to HTML, and send the result to the printer."
    After one week of reasearch I have not been able to do what Armstrong describes; print a String that contains text of MIME type text/html.
    I have checked the supported MIMI types of the Print Service returned by PrintServiceLookup.lookupDefaultPrintService(). This is the result:
    DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    aset.add(MediaSizeName.ISO_A4);
    aset.add(new Copies(2));
    PrintService[] service = PrintServiceLookup.lookupPrintServices(flavor,aset);
    if (service.length > 0) {
    System.out.println("Selected printer " + service[0].getName());
    DocFlavor[] flavors = service[0].getSupportedDocFlavors();
    for (int i = 0;i<flavors.length;i++) {
    System.out.println("Flavor "+i+": "+flavors.toString());
    Selected printer \\MUNIN-SERVER\HP LaserJet 2100 Series PCL 6
    Flavor 0: image/gif; class="[B"
    Flavor 1: image/gif; class="java.io.InputStream"
    Flavor 2: image/gif; class="java.net.URL"
    Flavor 3: image/jpeg; class="[B"
    Flavor 4: image/jpeg; class="java.io.InputStream"
    Flavor 5: image/jpeg; class="java.net.URL"
    Flavor 6: image/png; class="[B"
    Flavor 7: image/png; class="java.io.InputStream"
    Flavor 8: image/png; class="java.net.URL"
    Flavor 9: application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
    Flavor 10: application/x-java-jvm-local-objectref; class="java.awt.print.Printable"
    As you can see there is no support for text/html here.
    If anyone has a clue to what I'm missing here or any other (elegant, simple) way to print the contents of a JEditorPane, please speak up!
    Reply to: [email protected] or [email protected] or here in this forum

    Since you have 'printable' as one of your flavors, try this using a JTextPane (assuming you can dump your HTML into a JTextPane, which shouldn't be a big problem)...
    1. Have your JTextPane implement Printable
    ie. something like this:
    public class FormattedDocument extends JTextPane implements Printable 2. Read your HTML into the associated doc in the text pane.
    3. Implement the printable interface, since you have it as one of your available flavors (I'd imagine everybody has printable in their available flavors). Something like this:
    public int print(Graphics g, PageFormat pf, int pageIndex) {
            Graphics2D g2 = (Graphics2D) g;
            g2.translate((int)pf.getImageableX(), (int)pf.getImageableY());
            g2.setClip(0, 0, (int)pf.getImageableWidth(), (int)pf.getImageableHeight()); 
            if (pageIndex == 0)
                setupPrintView(pf);
            if (!pv.paintPage(g2, pageIndex))
                return NO_SUCH_PAGE;
            return PAGE_EXISTS;
        }Here's my setupPrintView function, which is executed once on page 0 (which still needs some polishing in case I want to start from page 5). It sets up a 'print view' class based on the root view of the document. PrintView class follows...
    public void setupPrintView(PageFormat pf) {
    View root = this.getUI().getRootView(this);
            pv = new PrintView(this.getStyledDocument().getDefaultRootElement(), root,
                               (int)pf.getImageableWidth(), (int)pf.getImageableHeight());Note of obvious: 'pv' is of type PrintView.
    Here's my PrintView class that paints your text pane line by line, a page at a time, until there is no more.
    class PrintView extends BoxView
        public PrintView(Element elem, View root, int w, int h) {
            super(elem, Y_AXIS);
            setParent(root);
            setSize(w, h);
            layout(w, h);
        public boolean paintPage(Graphics2D g2, int pageIndex) {
            int viewIndex = getTopOfViewIndex(pageIndex);
            if (viewIndex == -1) return false;
            int maxY = getHeight();
            Rectangle rc = new Rectangle();
            int fillCounter = 0;
            int Ytotal = 0;
            for (int k = viewIndex; k < getViewCount(); k++) {
                rc.x = 0;
                rc.y = Ytotal;
                rc.width = getSpan(X_AXIS, k);
                rc.height = getSpan(Y_AXIS, k);
                if (Ytotal + getSpan(Y_AXIS, k) > maxY) break;
                paintChild(g2, rc, k);
                Ytotal += getSpan(Y_AXIS, k);
            return true;
    // find top of page for a given page number
        private int getTopOfViewIndex(int pageNumber) {
            int pageHeight = getHeight() * pageNumber;
            for (int k = 0; k < getViewCount(); k++)
                if (getOffset(Y_AXIS, k) >= pageHeight) return k;
            return -1;
    }That's my 2 cents. Any questions?

  • Java Print Service API in Java Stored Procedure (Linux)

    Hi
    We are running an Oracle 10g database on Linux and I am in the proces of developing a java stored procedure which should utilize the Java Print Service API.
    I have made a simple stored procedure to list all available printers and the DocFlavors they support (se the code below).
    My problem is that no printers are listed. I have made a standalone java app. with the same code and executed it directly on the OS level of the Linux box through the Sun JDK 1.4.2 and here I get two printers.
    Is there any specific configuration I need to do to make it work?
    I am wondering if I need to grant specific authorisations through dbms_java for it to work...?
    Any help is greatlyh appreciated.
    ************************************** CODE BEGIN *************************************
    import javax.print.DocFlavor;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    public class TestPrintService {
    public TestPrintService() {
    public static void listPrinters() {
    // Get all available printers and their supported DocFlavors
    PrintService[] pservices =
    PrintServiceLookup.lookupPrintServices(null, null);
    System.out.println("Printer services: " + pservices.length);
    for (int i = 0; i < pservices.length; i++) {
    PrintService pservice = pservices;
    System.err.println("Printer: " + pservice);
    DocFlavor[] docFlavors = pservice.getSupportedDocFlavors();
    for (int j = 0; j < docFlavors.length; j++) {
    DocFlavor docFlavor = docFlavors[j];
    System.err.println("DocFlavor " + docFlavor.toString());
    System.err.println();
    ************************************** CODE END *************************************
    Cheers,
    Jacob Vennervald

    Found this on Oracle support:
    Cannot List Available Printers From The Database Using A Java Stored Procedure [ID 372694.1]
    Applies to:
    Oracle Server - Enterprise Edition - Version: 10.1.0.4.0
    This problem can occur on any platform.
    Symptoms
    Able to list available printers on a machine when running Java code outside the Database.
    When running the same Java code inside the Database as a Java Stored Procedure, no printers are found.
    Cause
    Due to security restrictions, this is expected results.
    The Java Docs state:
    "Services which are registered by registerService(PrintService) will not be included in lookup
    results if a security manager is installed and its CheckPrintJobAccess() method denies access."
    Also from the documentation it states:
    "A PrintServiceLookup implementor is recommended to check for the SecurityManager.checkPrintJobAccess() to deny access to untrusted code. Following this recommended policy means that untrusted code may not be able to locate any print services. Downloaded applets are the most common example of untrusted code."
    Using the checkPrintJobAccess(); call, it does produce a Security Exception when run inside the Database but not when run outside. The exception can be viewed within the log file found in the UDUMP directory.
    Solution
    Run the following code to confirm obtaining available __printers can not be done...__
    This is the code to create the Java Stored Procedure
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ListPrinters" AS
    import javax.print.*;
    public class ListPrinters {
    public static String AvailablePrinters(){
    String strList;
    PrintService[] pservices =PrintServiceLookup.lookupPrintServices(null,null);
    if (pservices.length > 0 )
    strList = pservices[0].getName();
    else
    strList = "No printers found";
    return strList;
    public static String listprinters() throws Exception {
    String listofprinters;
    try {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) sm.checkPrintJobAccess();
    catch (SecurityException ex) {
    System.err.println("Sorry. Printing is not allowed.");
    listofprinters = AvailablePrinters();
    return listofprinters;
    This is the PL/SQL Wrapper
    CREATE OR REPLACE FUNCTION Get_Printer_Test RETURN VARCHAR2 IS
    LANGUAGE JAVA
    NAME 'ListPrinters.listprinters() return String';
    This executes the code
    SQL> SELECT Get_Printer_Test FROM DUAL;
    GET_PRINTER_TEST
    No printers found
    This is the output found in the trace file in the UDUMP directory
    *** SESSION ID:(144.28) 2006-07-08 09:02:25.518
    Sorry. Printing is not allowed.

  • Does java print service support word docs or text files

    Can anyone tell me that java print service api allows to print word doc files or RTF files etc.

    no it doesn't.
    To print a Word Doc you need to be able to read it, and display it.
    Anything that can be displayed in, say a JPanel, can be printed, cos it's just a matter of displaying the
    image to a virtual component ( a print canvas ). Which then gets printed.
    So, because Java doesn't immediately support Ms Docs, neither does the print service.
    regards,
    Owen

  • Turn off banner within Java Print Service API

    I have web services running on JBoss 4.0.5, which is running on IBM AIX 5.
    The issue I have is anytime I try to print something through Java Print Service within web services, there is always a banner, even though banner property is set to "never" on the print queue with AIX smitty. The bad news is that property value can be overwritten by applications, or by command line options with lp or lpr commands.
    Couldn't find any way or any attribute avaiable in Print Service API to diable banner printing. Currently only default attributes are used in document printing.
    Any help would be greatly appriciated!

    fermar84 wrote:
    Thanks for answering,
    Yes i totally agree with you. There is a per device basis. However you could think (and here i am letting my imagination fly) about categorizing devices, lets say all the digital cameras. Although it would still be per-device basis, some would have common commands like turn on, or turn off. Don't you think so?
    Now lets take a simple example, can a Java program turn off the computer where its running?
    Thanks in advance,
    FernandoDo I think all digital cameras expose an "on/off" API? No, I don't. Some may, they all may, but that's in no way a Java issue.
    Can a Java program turn off a PC? No. It can call native code to do so, but then it isn't Java doing the work. All of what you're talking about is very much platform-specific, and that's where Java is generally it's weakest

  • Java print services  UnsatisfiedLinkError

    i'm try to run the program given with java print services guide
    i.e PrintPS.java...
    and got this error...any idea what went wrong...
    Exception in thread "main" java.lang.UnsatisfiedLinkError: getDefaultPrinterName
    at sun.print.Win32PrintServiceLookup.getDefaultPrinterName(Native Method
    at sun.print.Win32PrintServiceLookup.getDefaultPrintService(Win32PrintSe
    rviceLookup.java:198)
    at sun.print.Win32PrintServiceLookup.getPrintServices(Win32PrintServiceL
    ookup.java:61)
    at sun.print.Win32PrintServiceLookup.getPrintServices(Win32PrintServiceL
    ookup.java:157)
    at javax.print.PrintServiceLookup.getServices(PrintServiceLookup.java:35
    9)
    at javax.print.PrintServiceLookup.lookupPrintServices(PrintServiceLookup
    .java:105

    I also have this same problem. Please help me out when you got the solution. my email address: [email protected]
    Thanks.

  • 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Can't locate any printers (w/ Java Print Service)

    Hi all,
    I'm using the following code to locate print services on my Windows 2000 laptop:
    private PrintService[] drucker;
    private DocFlavor format = DocFlavor.INPUT_STREAM.TEXT_HTML_HOST;
    private Doc output;
    private PrintRequestAttributeSet printerAttributes;
    private FileInputStream stream;
    public PrintHandler() {
    printerAttributes = new HashPrintRequestAttributeSet();
    printerAttributes.add(OrientationRequested.LANDSCAPE);
    printerAttributes.add(MediaSizeName.ISO_A4);
    drucker = PrintServiceLookup.lookupPrintServices(format, printerAttributes);
    Although there are several printers installed my app can't find any. I'm pretty sure that they support the attributes.
    What am I doing wrong?
    Thanks for your help,
    Ulf Moehring

    try this:
    PrintService[] availableServices = PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);That will give you a list of all printable printers.
    Then if you wish, you can do:
    javax.swing.DefaultComboBoxModel printerCM = new javax.swing.DefaultComboBoxModel();
    for(int i = 0; i < availableServices.length; i++) {
        printerCM.addElement(availableServices.getName());
    comboBoxPrinter.setModel(printerCM);
    Hope that helps,
    James.

  • Urgent java print service API ?

    Hi all,
    I would like to use javax.print.*;
    libraries but I am using jdk1.3.1, I think in jdk1.3.1
    there is no javax.print.*; libraries , so how can I download the
    only java print API from jdk1.4..
    if anyone knows please help me..
    thanks

    You can't. You must upgrade your SDK to 1.4

  • Java print service + print specific page

    is there anybody know how to print specific page to the printer in java?
    i am using below code. it able to print any txt file from page 1 to n. it just cannot work on printing on specific page??
    code
    String fileName = "NORMAL.txt";
         DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
    //DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PAGEABLE;
         FileInputStream pclStream = new FileInputStream(fileName);
         PrintRequestAttributeSet attributes2 = new HashPrintRequestAttributeSet();
         //attributes2.add(new Copies(1));
         Doc doc = new SimpleDoc(pclStream, flavor, null );
         PrintService[] services = PrintServiceLookup.lookupPrintServices( null, attributes2);
         PrintService service = ServiceUI.printDialog(null,50,50,services,services[0],null, attributes2 );
         if(service != null) {
         DocPrintJob dpj = service.createPrintJob();
         dpj.print(doc,attributes2);

    See it!!!
    bye bye
    import javax.print.DocFlavor;
    import java.io.FileInputStream;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.SimpleDoc;
    import javax.print.PrintService;
    import javax.print.ServiceUI;
    import javax.print.Doc;
    import javax.print.PrintServiceLookup;
    import javax.print.DocPrintJob;
    import java.io.File;
    import java.awt.GraphicsConfiguration;
    import java.awt.Rectangle;
    import java.awt.GraphicsEnvironment;
    import java.awt.GraphicsDevice;
    public class Untitled1 {
    public Untitled1() {
    try {
    Rectangle virtualBounds = new Rectangle();
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    String fileName = "NORMAL.txt";
    DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
    FileInputStream pclStream = new FileInputStream(fileName);
    PrintRequestAttributeSet attributes2 = new HashPrintRequestAttributeSet();
    Doc doc = new SimpleDoc(pclStream, flavor, null );
    PrintService[] services = PrintServiceLookup.lookupPrintServices( flavor, attributes2);
    PrintService service = ServiceUI.printDialog(gc,50,50,services,services[0],flavor, attributes2 );
    if(service != null) {
    DocPrintJob dpj = service.createPrintJob();
    dpj.print(doc,attributes2);
    catch (Exception err) {
    public static void main(String[] args) {
    Untitled1 untitled11 = new Untitled1();
    }

  • Help needed in Java Printing Service

    I need to print an image using the new JPS API, but with specific requirements.
    I managed to find out how to get the image printed from my HD onto the printer by using the example given in the JPS user guide. But I can't seem to find out how to achieve the most important requirement.
    I need to be able to control the printing position as well as the printed size of the image. Can anyone help me with it? I can't seem to find proper documentation that is related to the topic.
    Thanks in advance.

    I tried using the MediaSize class by constructing a custom sized media. But when I compiled it, I kept getting a "cannot resolve symbol" error for MediaSize.
    Then returning to the MediaSize documentation page, it said that it is not yet used to specify media. Does that mean I have to wait?
    The other thing is, I tried another approach using the java.awt.print package. Can you help me out with this piece of code, how do I correct it :
    Paper paper = new Paper();
    PageFormat page = new PageFormat();
    paper.setImageableArea(0,0,600,800);
    page.setPaper(paper);
    DocPrintJob printJob = pservices[0].createPrintJob(); *
    printJob.setPrintable(this,page);
    I am using the javax.print package on the * line, but the rest is from the java.awt.print method. However, I kept getting a "non-static variable cannot be referenced from a non-static context" error.
    What's wrong? Thanks.

  • Java Printing Service (JPS) How to get printer status and pending jobs list

    Hi,
    I am trying to determine what is the current status of a printer in my computer as well as what is the list of pending printing jobs at any moment.
    I want to monitor activity on a printer in my computer, so I can capture and log the jobs that are sent to my printer over time.
    I would like to do so by monitoring the printer pending jobs list (if that can be retrieved through any java method) and make a log of changes in that list.
    Any advice on how to get the list of pending jobs of a printer?
    I checked the API and JobState class seems to be a descriptor of one single job... I suppose the method to retrieve a list of pending jobs in a printer would return an array of JobState objects... but I have not being able to find yet such method...
    Thanks in advance,
    JN

    Moderator Action:
    This post has been moved from the Java Programming,
    to the ADF forum, for closer topic alignment.
    *... and Comment:*
    Get help from people that work with ADF.
    They may have already done something like this.

  • Successful using Java Print Service API on Windows 32 Platform

    Hello,
    Using the JSP API supplied with JDK1.4, I was able to print successfully the following types of documents :
    1. Text
    2. GIF, JPG... (images)
    3. PostScript files.
    But could not print "HTML" files. THe problem is that the HTML files are getting printed as text files with all the HTML tags.
    Any pointers are appreciated.
    Thanks
    TJ

    You will need to load the html into something that can render html. The printer doesn't know how to do it. It just sees plain text that you are sending. Try using JTextPane or JEditorPane (I think). It can render html files for you. Then just print that component.
    1) Create JEditorPane or JTextPane.
    2) Set contents of pane as the html file or string you want to print.
    3) Use the Graphics2D API to adjust the component coordinate space to the printer coordinate space.
    4) Render the component (JEditorPane or JTextPane) on the printer.
    There is a very nice tutorial for printing components here: http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html.
    Hope this helps.

  • Select the printer tray using the Java Print Service with JDK 1.4.2

    Hello,
    I have got a problem with 1.4 Printing. I would like to specify the printer tray for printing on Windows platform (XP and NT4.0). I am trying to use the attribute javax.print.attribute.standard.MediaTray class (ex. MediaTray.BOTTOM).
    Howerver, I can control the printer tray if I use the PCL driver of the printer. If I user the postscript driver I am not able to control the printer tray. I can reproduce the problem with 3 different printers (HP, Lexmark and Nashuatec).
    I used the getSupportedAttributeValues to check the supported values of the Media
    Media med[] = (Media[])service.getSupportedAttributeValues(Media.class, null, null);
    for (int k=0; k<med.length; k++) {
    System.out.println("Name : " + med[k].getClass() + " - Value : " + med[k].getValue());     
    With the PCL driver I have the following output and I can control the printer tray.
    Name : class javax.print.attribute.standard.MediaTray - Value : 0
    Name : class javax.print.attribute.standard.MediaTray - Value : 2
    Name : class javax.print.attribute.standard.MediaTray - Value : 4
    Name : class sun.print.Win32MediaTray - Value : 0
    Name : class sun.print.Win32MediaTray - Value : 1
    With the postscript driver I have the following output and I cannot control the printer tray
    Name : class sun.print.Win32MediaTray - Value : 5
    Name : class sun.print.Win32MediaTray - Value : 6
    Name : class sun.print.Win32MediaTray - Value : 7
    Name : class sun.print.Win32MediaTray - Value : 8
    Name : class sun.print.Win32MediaTray - Value : 9
    As I must use the postscript printer, can someone help me?
    Thanks.

    Hello,
    Can you tell me how it's possible to selet the tray using the PCL?
    I print on the following way:
    PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
    AttributeSet aset = new HashAttributeSet();
    aset.add(new PrinterName("\\\\107208\\SBE08111", null)); // select printer
    ......Now I tried to add your code and I get the following output:
    0: Name : class javax.print.attribute.standard.MediaSizeName - Value : 40
    1: Name : class javax.print.attribute.standard.MediaSizeName - Value : 41
    2: Name : class javax.print.attribute.standard.MediaSizeName - Value : 45
    3: Name : class javax.print.attribute.standard.MediaSizeName - Value : 42
    4: Name : class javax.print.attribute.standard.MediaSizeName - Value : 4
    5: Name : class javax.print.attribute.standard.MediaSizeName - Value : 5
    6: Name : class javax.print.attribute.standard.MediaSizeName - Value : 27
    7: Name : class javax.print.attribute.standard.MediaSizeName - Value : 46
    8: Name : class javax.print.attribute.standard.MediaSizeName - Value : 59
    9: Name : class javax.print.attribute.standard.MediaSizeName - Value : 60
    10: Name : class javax.print.attribute.standard.MediaSizeName - Value : 55
    11: Name : class javax.print.attribute.standard.MediaSizeName - Value : 38
    12: Name : class javax.print.attribute.standard.MediaSizeName - Value : 16
    13: Name : class javax.print.attribute.standard.MediaSizeName - Value : 57
    14: Name : class javax.print.attribute.standard.MediaTray - Value : 0
    15: Name : class javax.print.attribute.standard.MediaTray - Value : 2
    16: Name : class javax.print.attribute.standard.MediaTray - Value : 1
    17: Name : class javax.print.attribute.standard.MediaTray - Value : 6
    18: Name : class javax.print.attribute.standard.MediaTray - Value : 4
    19: Name : class sun.print.Win32MediaTray - Value : 0
    20: Name : class sun.print.Win32MediaTray - Value : 1
    It's a printer with to trays, so I suppose the last two lines are important, but I'm not possible to effectively select the tray I want to print..

Maybe you are looking for

  • Blue Screen of Death When Plugging in Ipod Touch 4g

    Hello, Im reciving blue screen of death when I plug in my ipod touch 4g. I have updated itunes, Drivers, This happens every time and I suspect it happens when my computer says found new hardware reconizing the ipod as a camera because once I pluged m

  • HP Officejet 6600 phone / fax? issue

    I have had my officejet 6600 a couple of years now.  No issues until today.  I have ATT phones and internet.  Tagged my HP Officejet 6600 as the default printer today and somehow my telephone no longer works.  No dial tone.  The ATT tech came out and

  • Adobe Premiere Pro CC Crash on Splash Screen

    My Adobe Premiere Pro CC 2014 is crashing on the splash screen. My Adobe Premiere Pro CC was not crashing until 2014. I am very angry and frustrated this subpar update was forced on us. I have tried: Uninstalling and re-installing SEVERAL TIMES I hav

  • Macbook Pro Running Slow and have NO Idea Why!

    For the last few days, my 10 month old Macbook Pro has been running really slowly. Sometimes, it is perfectly normal. But other times, it just is really slow. Typing will show up a few seconds later, it will take a few seconds to switch tabs in safar

  • How to get a sum of the result?

    I want to get the results to display the records only once if I have the same case number. This is my query. SELECT distinct c.case_number, c.bank_name, i.first_name, i.last_name, it.id_name, i.id_number1, i.date_of_birth, i.country_of_birth, (select