Javax.print.PrintServiceLookup operation

I am trying to find out where this method gets the printServices from. I have an application that is run on three different os's and most likely 3 different versions of java.
box1: Debian Sarge(3.1) , jdk1.6.0_14, cups 1.1.23
box2: Debian Lenny/Sid, jdk1.6.0.07, cups 1.3.7
box3: Ubuntu 9.04, jdk1.6.0_14, cups 1.3.9
cups server: Debian Lenny cups 1.3.8
All printers are broadcast from the cups server , box1-3 only see the broadcast printers.
My program is able to print on box1 and 2 to the three printers shared via the cups server that I want it too.(sales,invoicing,shipping).
When I try and print to either invoicing or shipping(sales is the default on all boxes) I get an error and the job is sent to the default.
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
for (int j=0; j<services.length;j++) {
logger.debug("Printer returned from system: " + services[j].getName());
if (services[j].getName().equals(cmbPrinters.getSelectedItem())){
selectedPrinterService = services[j];
my logger output shows that an array of length 5 is returned(that is right, a total of 6 printers on the system) but only services[0] has an entry, sales. The rest of the positions are null.
I am trying to figure out where PrintServiceLookup gets this information, I have found that this same problem holds true for any other Ubunutu 9.04 box that I set up around here.
lpstat -v shows all of the printers shared via the cups server, the default sales is not listed as the first position so I am not sure if PrintServiceLookup just moves the default system printer into this location or not.
Thank you.
Grant

you got me, I did have a question. I was trying to figure out where javax.print.PrintServiceLookup.lookupPrintServices got the returned PrintServices from. I can not figure out why my printers all work from other programs on all my servers, but inside this one program, the one everyone here uses I can only print to the default printer when using box3, but print to the printer of my choice on box 1 and 2. Basically what is lookupPrinterServices() checking to find out what printers are available.

Similar Messages

  • Javax.print.PrintServiceLookup

    The static lookupPrintServices(DocFlavor flavor, AttributeSet attributes) method of the PrintServiceLookup class returns an array of PrintService objects that can handle the given document flavor.
    The current 1.4 SDK supplies print services for basic document flavors such as images and 2D graphics. However, if you try to print text or HTML documents, the lookup will return a zero-length array (indicating that no services match the document flavor).
    Are there plans to provide default print services for the other document flavors in the INPUT_STREAM class (i.e., TEXT_PLAIN_HOST, etc.)?

    you must use components to render the HTML first....JEditorPanes have a contentType property that can be set to "text/html" and render html source as a displayed html page. You must then find another way to get it to the printer. A good strategy is to create a subclass of JEditorPane that implements java.awt.Printable and define a print() method that would render it...this method could be as simple as calling the paint method of the parent class. Also another way to find a print service is to use the static method java.awt.PrinterJob.lookupPrintServices() this returns a PrintService[].
    Now of these services none will be able to turn html source into formatted text, but you can create a SimpleDoc with the DocFlavor.SERVICE_FORMATTED.PRINTABLE and pass it the java.awt.print.Printable object

  • How can I print a html Using javax.print

    Hi friends,
    I am in big trouble . I use following code to print a html file using javax.print api.
    import java.io.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.print.event.*;
    public class PrintPS
         public static void main(String args[]) {
              PrintPS html = new PrintPS();
         public PrintPS() {
         DocFlavor flavor = DocFlavor.INPUT_STREAM.TEXT_HTML_HOST;
         PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
         aset.add(MediaSizeName.ISO_A4);
         aset.add(new Copies(1));
         aset.add(MediaTray.MAIN);
         PrintService pservices = PrintServiceLookup.lookupDefaultPrintService();
         if(pservices==null)
              System.out.println(" printer not found");
         if (pservices!= null) {
         System.out.println("selected printer " + pservices.getName());
         DocPrintJob pj = pservices.createPrintJob();
         try {
         InputStream fis = new FileInputStream("abc.html");
         Doc doc = new SimpleDoc(fis, flavor, null);
    System.out.println("printing started ");
         pj.print(doc, aset);
    System.out.println("printing completed");
         } catch (IOException ie) {
         System.err.println(ie);
         } catch (PrintException e) {
         System.err.println(e);
    This code gives me "sun.print.PrintJobFlavorException: invalid flavor"
    So i use all four TEXT_HTML flavor but i do not find the solution.
    I am able to print pdf, jpg, gif files but i can not able to print txt and html file.
    My printer supports txt and html printing becaue i do printing directolly by browser's or notpad's print command .

    Hi friends,
    I am in big trouble . I use following code to print a
    html file using javax.print api.Use Code Tags
    http://forum.java.sun.com/help.jspa?sec=formatting
    My printer supports txt and html printing becaue i do
    printing directolly by browser's or notpad's print
    command .Notepad & your browser prob. convert to the HTML/text(1) into the printers native format.
    1) I am suprised that it does not print text.

  • Javax.print problem: data not of declared type

    Hi all,
    I'm trying to print a simple text-only document with the below code but it keeps giving me an illegal argument exception. By the way, I've tried all the combinations of DocFlavor.*.* and SERVICE_FORMATTED.PRINTABLE and SERVICE_FORMATTED.PAGEABLE are the only ones working for me. Is this normal?
    Thanks!
    IllegalArgumentException:
    java.lang.IllegalArgumentException: data is not of declared type
            at javax.print.SimpleDoc.<init>(SimpleDoc.java:82)
            at DiagnosticsPane.actionPerformed(DiagnosticsPane.java:350)
    import java.io.*;
    import javax.print.*;
    import javax.print.attribute.*;
    class testPrint
         public static void main(String args[])
              PrintRequestAttributeSet pras =     new HashPrintRequestAttributeSet();
              DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
              PrintService ps[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
              PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
              PrintService service = ServiceUI.printDialog(null, 200, 200, ps, defaultService, flavor, pras);
              if (service != null) {
                   try {
                        DocPrintJob job = service.createPrintJob();
                        DocAttributeSet das = new HashDocAttributeSet();
                        FileInputStream fis = new FileInputStream("report.txt");
                        Doc doc = new SimpleDoc(fis, flavor, das);
                        try {
                             job.print(doc, pras);
                             System.err.println("Job sent to printer.");
                        } catch (PrintException e) {
                             System.err.println("Print error!\n\n" + e.getMessage());
                   } catch (FileNotFoundException e) {
                        System.err.println("File not found!\n\n" + e.getMessage());
    }

    Hi duffymo,
    I've tried all the available DocFlavors and even wrote a little program to list all my supported DocFlavors. And, I've only got 2 available for each of my printers, one being a Canon i320 and the other is a Adobe PDF printer.
    import javax.print.*;
    import javax.print.attribute.*;
    class listDocFlavor
      public static void main(String args[])
        PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
        DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
        PrintService ps[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
        for (int j = 0; j < ps.length; j++) {
          DocFlavor df[] = ps[j].getSupportedDocFlavors();
          for (int i = 0; i < df.length; i++)
            System.err.println(j + ": " + df);
    0: application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
    0: application/x-java-jvm-local-objectref; class="java.awt.print.Printable"
    1: application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
    1: application/x-java-jvm-local-objectref; class="java.awt.print.Printable"

  • PDF printing using javax.print

    Hi!
    I need to create an aplication that generates a PDF document and then prints it. For creating the PDF doc, I use the iText package.
    I have some problems with printing. I don't know how to print the document I generate. Could you give me a hint please? (I can print GIF docs, yet I do not know how to convert the PDF to GIF).
    Thanks in advance,
    Alex

    import javax.print.*;
    import javax.print.attribute.DocAttributeSet;
    import javax.print.attribute.HashDocAttributeSet;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.Copies;
    import javax.print.attribute.standard.MediaSizeName;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    public class PDFfilePrinter {
    public static void main(String[] args) {
    DocAttributeSet fset = new HashDocAttributeSet();
    PrintRequestAttributeSet pset = new HashPrintRequestAttributeSet();
    String filename = "somefile.pdf"; //name of file to print
    DocFlavor docf = DocFlavor.INPUT_TYPE.PDF;
    PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
    if (0 < services.length) {
    DocPrintJob printer = services[0].createPrintJob(); //default printer on my system
    try {
    FileInputStream fis = new FileInputStream(filename);
    Doc toprint = new SimpleDoc(fis, docf, fset);
    pset.add(MediaSizeName.ISO_A4);
    pset.add(new Copies(1));
    printer.print(toprint, pset);
    } catch (PrintException e) {
    e.printStackTrace();
    } catch (FileNotFoundException fnfe) {
    fnfe.printStackTrace();
    Here's the code I'm working with for printing. This stuff works .... in a very strange way - it prints out all sort of crazy characters. I know I am doing something wrong and I think it's all in this line:
    DocFlavor docf = DocFlavor.INPUT_TYPE.PDF;
    Should I use a different flavor? I read somewhere that the PDF file format is not entirely supported bye javax.print. Could this be the problem?
    Thanks in advance,
    Alex

  • Any one uses javax.print API and works?

    I have just downloaded 1.4 beta2 SDK and imported all the javax.print classes. I use the most simple test code as the following:
    FileInputStream fis = new FileInputStream("test.txt");
    try {
    DocFlavor psInFormat = DocFlavor.INPUT_STREAM.TEXT_PLAIN_US_ASCII;
    Doc myDoc = new SimpleDoc(fis, psInFormat, null);
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    aset.add(new Copies(1));
    aset.add(MediaSizeName.ISO_A4);
    aset.add(Sides.ONE_SIDED);
    PrintService[] services = PrintServiceLookup.lookupPrintServices(psInFormat, aset);
    if (services.length > 0) {
    DocPrintJob job = services[0].createPrintJob();
    job.print(myDoc, aset);
    } catch (Exception e) {System.out.println(e.getMessage());}
    However, PrintServiceLookup.lookupPrintServices can't find my printer. I have 9 network printers connected to my system which range from HP LaserJet 4500 to 8100 and Acrobat PDFWriter. The API can't find any of my printer? What did I do wrong

    Hi Guys,
    First,
    If your trying to print any document sent by the server from the client machine u have to write a applet which recieves the output in form of stream and then print it. I could do these with JPEG, GIF and ASCII but could not do it with PDF (The sun doesn't have a implementation for PDF document printing, they just have a declaration may future released will help us print PDF).
    If u want the Print dialog box to appear use the following code that worked fine for me.
    public class SomeClass
    public static void main(String args[]) throws Exception
    PrintRequestAttributeSet pras =     new HashPrintRequestAttributeSet();
    DocFlavor flavor = DocFlavor.INPUTSTREAM.GIF;
    PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, pras);
    PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
    PrintService service = ServiceUI.printDialog(null, 200, 200,printService, defaultService, flavor, pras);
    if (defaultService != null)
    DocPrintJob job = defaultService.createPrintJob();
    FileInputStream fis = new FileInputStream("somefile.GIF");
    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc = new SimpleDoc(byteArrayOutputStream, flavor, das);
    job.print(doc, pras);
    Thread.sleep(10000);
    If u do not want the dialog box to appear and just print to the default printer of the local machine use the following code
    public class SomeClass
    public static void main(String args[]) throws Exception
    PrintRequestAttributeSet pras =     new HashPrintRequestAttributeSet();
    DocFlavor flavor = DocFlavor.INPUTSTREAM.GIF;
    PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
    if (defaultService != null)
    DocPrintJob job = defaultService.createPrintJob();
    FileInputStream fis = new FileInputStream("somefile.GIF");
    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc = new SimpleDoc(byteArrayOutputStream, flavor, das);
    job.print(doc, pras);
    Thread.sleep(10000);
    Mean while if some body comes across any tweaks to print PDF documents using j2se1.4 please write to me at
    [email protected]
    Regards,
    Madhu

  • Javax.print binary format

    HI!
    I know there are several posts about javax.print and the binary format, but i found nothing that helps me.
    I'm trying to print a txt file
    public class print{
         public static void main(String args[]){
    //          Input the file
         InputStream textstream=null;
         try {
              textstream = new BufferedInputStream(new FileInputStream("test.txt"));
         catch (FileNotFoundException ffne) {
              ffne.printStackTrace();     
    //          Set the document type
         DocFlavor myFormat = DocFlavor.INPUT_STREAM.TEXT_PLAIN_UTF_8;
    //          Create a Doc
         Doc myDoc = new SimpleDoc(textstream, myFormat, null);
    //          Build a set of attributes
         PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
         aset.add(new Copies(5));
         aset.add(MediaSizeName.ISO_A4);
         PrintService services =
              PrintServiceLookup.lookupPrintServices(myFormat, aset);
    //          Create a print job from one of the print services
         if (services.length > 0) {
              DocPrintJob job = services.createPrintJob();
              try {
                   job.print(myDoc, aset);
              catch (PrintException pe) {
                   pe.printStackTrace();
         else
         System.out.println("!hello");
    What's wrong witht this code?
    If I run it I get the output hello which meas that there is no printer to handle the file.
    Does anybody know a good tutorial about printing files?
    Pls help
    Thanks Jerome

    There's a long standing thread under Advanced Language Topics:
    javax.print and binary formats
    I'm surprised that a search of the forums didn't turn it up. - MOD

  • Find the network printer print jobs names using  the javax.print

    hi friend ,
    i have a problem to find the network printer printjobs names using javax.prrint pacakge. And give the best sites for example of javax.print.

    Iterate the array from:
    PrintService[] services = PrintServiceLookup.lookupPrintServices( null, null );

  • Javax.print problems on applet - bug on mac os implementation?

    Dear All,
    I am working on an applet and application that include a print function and I get a weird behaviour on MacOS in applet mode (both with Safari and Firefox - Mac OS X Versione 10.4.9 (Build 8P135) ). In contrast, things work fine on Windows XP (both Explorer 7 and Firefox with Java Plug-in 1.6.0_01) and even in MacOS when using the application.
    The problems are:
    - the print dialogue goes on and off a few times before letting the user interact with it
    - the page format in the dialogue is set to A5 (instead of the printer's default)
    - there is a small empty window appearing together with the dialogue and not disappearing even after the applet is closed
    Is this a known problem? If so, are there work-arounds?
    (I had no luck on Google about this)
    To reproduce the problem I created a stripped down version of the applet, in 2 files, I report it at the bottom of this message. I am using a modified version the PrintUtilities class from http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-Printing.html
    Am I doing something wrong? Or shall I consider submitting a bug report?
    Any suggestion is welcome! Please let me know if I should provide more detailed information.
    Thank you in advance,
    Enrico
    PrintMe.java
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JApplet;
    import javax.swing.JPanel;
    public class PrintMe extends JApplet implements MouseListener{
         private static final long serialVersionUID = 1L;
         private JPanel jContentPane = null;
         public PrintMe() {
              super();
         private class MyComponent extends JPanel{
              private static final long serialVersionUID = 1L;
              public void paintComponent(Graphics g) {
                   super.paintComponent(g);
                  Graphics2D g2 = (Graphics2D) g;
                  g2.setColor(Color.black);
                  g2.drawString( "Test text", 0, g2.getFontMetrics().getHeight() );
         public void init() {
              MyComponent aComponent = new MyComponent();
              jContentPane = new JPanel();
              jContentPane.setLayout(new BorderLayout());
              jContentPane.add(aComponent);
              this.setContentPane(jContentPane);
              this.addMouseListener(this);
         public void print(){
              try{
                   PrintUtilities.printComponent(this);
              }catch (Exception e) {
                   e.printStackTrace();
         public void mouseClicked(MouseEvent e) {
              print();
         public void mouseEntered(MouseEvent e) {
              // not used
         public void mouseExited(MouseEvent e) {
              // not used
         public void mousePressed(MouseEvent e) {
              // not used
         public void mouseReleased(MouseEvent e) {
              // not used
    PrintUtilities.java
    import java.awt.Component;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.swing.RepaintManager;
    import javax.swing.RootPaneContainer;
    /** A simple utility class that lets you very simply print
    *  an arbitrary component. Just pass the component to the
    *  PrintUtilities.printComponent. The component you want to
    *  print doesn't need a print method and doesn't have to
    *  implement any interface or do anything special at all.
    *  If you are going to be printing many times, it is marginally more
    *  efficient to first do the following:
    *    PrintUtilities printHelper = new PrintUtilities(theComponent);
    *  then later do printHelper.print(). But this is a very tiny
    *  difference, so in most cases just do the simpler
    *  PrintUtilities.printComponent(componentToBePrinted).
    *  7/99 Marty Hall, http://www.apl.jhu.edu/~hall/java/
    *  May be freely used or adapted.
    public class PrintUtilities implements Printable {
         private Component componentToBePrinted;
         public static void printComponent(Component c) {
              new PrintUtilities(c).print();
         public PrintUtilities(Component componentToBePrinted) {
              this.componentToBePrinted = componentToBePrinted;
         public void print() {
              try{
                   PrinterJob printJob = PrinterJob.getPrinterJob();
                   printJob.setPrintable(this);
                   PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
                   if( printJob.printDialog(attributes) ){
                        try {
                             printJob.setJobName("MyName");
                             printJob.print(attributes);
                        } catch(PrinterException pe) {
                             System.err.println("Error printing: " + pe);
                             pe.printStackTrace();
              }catch (Exception e) {
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
              if (pageIndex > 0) {
                   return(NO_SUCH_PAGE);
              } else {
                   RootPaneContainer rpc = (RootPaneContainer)(this.componentToBePrinted);
                   rpc.getRootPane().getGlassPane().setVisible( false );
                   Graphics2D g2d = (Graphics2D)g;
                   double sy = pageFormat.getImageableHeight() / componentToBePrinted.getHeight();
                   double sx = pageFormat.getImageableWidth() / componentToBePrinted.getWidth();
                   if( sx > sy ){
                        sx = sy;
                   }else{
                        sy = sx;
                   g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
                   g2d.scale(sx, sy);
                   disableDoubleBuffering(componentToBePrinted);
                   componentToBePrinted.paint(g2d);
                   enableDoubleBuffering(componentToBePrinted);
                   return(PAGE_EXISTS);
         /** 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);
    }

    Trying to answer to myself..
    Is it possible that the problems are due to me mixing java.awt.print and javax.swing.print ?

  • Cannot import javax.print.*;

    Hi All,
    I have to send a file to printer Directly.
    For this i want to use java print service API.
    I installed J2SE 1.4.2
    But i could not import javax.print.*;
    Plese help me.

    The package javax.print was added in Java version 1.4, so if you are using 1.4.2 you should be able to use it.
    Are you sure you are using Java 1.4.2? Don't you have another version of Java installed somewhere? Open a command prompt and type:
    java -version
    Which version does it say you're using?

  • Javax.jms.IllegalStateException: Operation not allowed

    Hi all, (first time posting, so go easy on me!)
    just wondering can anyone out their shed some light on a problem I am having here with JMS. I am attempting to access JMS from a stateless EJB. The problem is I get an illegalStateException when I call "setMessageListener(..)". The bean simply creates an object (which implements the MessageListener interface) passing an RMI client callback reference into the constructor. The idea here is that when JMS forwards a message onto my listener, in the onMessage(..) function I call back into the RMI client. So the idea sounds simple, but JMS wont let me register the listener from the EJB. Heres some code and the exception which is generated (including the call stack):
    jndiContext = new InitialContext();
    Object objRef = (Object)jndiContext.lookup ("java:comp/env/jms/TopicConnectionFactory");
    topicConnectionFactory = (TopicConnectionFactory)PortableRemoteObject.narrow(objRef, TopicConnectionFactory.class);
    topic = (Topic) jndiContext.lookup(topicName);
    topicConnection = topicConnectionFactory.createTopicConnection("Administrator", "123");
    topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    topicSubscriber = topicSession.createSubscriber(topic);
    AppletSubscriber as = new AppletSubscriber(listener);
    topicSubscriber.setMessageListener(as); // here's were the exception is thrown
    Here's the exception & stack trace:
    JMS Exception registerEventsListener: javax.jms.IllegalStateException: Operation
    not allowed
    javax.jms.IllegalStateException: Operation not allowed
    at com.sun.enterprise.jms.MessageConsumerWrapperRestricted.setMessageLis
    tener(MessageConsumerWrapperRestricted.java:40)
    at RespondAdministrator.registerUserEventsListener(RespondAdministrator.
    java:61)
    at UserLogOnEJB.registerUserEventsListener(UserLogOnEJB.java:53)
    at UserLogOnEJB_EJBObjectImpl.registerUserEventsListener(UserLogOnEJB_EJ
    BObjectImpl.java:57)
    at UserLogOnEJBEJBObjectImpl_Tie._invoke(Unknown Source)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Ge
    nericPOAServerSC.java:519)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Gen
    ericPOAServerSC.java:204)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAS
    erverSC.java:112)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
    at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProces
    sor.java:84)
    at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadP
    ool.java:99)
    thanks in advance, this is driving me nuts.

    The reason you get this is that you cannot use MessageListeners within a J2EE environment. The J2EE specification says that this method should not work from within EJBs. If you wish to have asynchronous message delivery from an EJB you need to use EJB 2.0s Message Driven Beans.
    Hope this helps.

  • Using Javax.print I have to print the data which are stored in resultsets.

    Using Javax.print I have to print the data which are stored in resultsets.
    Actually we ar working on a project where n numbers of records are fetched from database and stored in Resultsets. We made JSF pages which displayes the records in Web Browser.
    There is a link in that page. If we click that print link, It has to be printed all the records row by row using javax.print. It should act like Printer friendly in browser.
    Kindly send us any example code to proceed.

    Is it possible to access the cache datasource inside the script component which is available in the same data flow task??
    Thanks in advance,
    Saravanan

  • Javax.print

    hi
    In which jar can i find the following packages?
    javax.print.*;
    javax.print.attribute.*;
    javax.print.attribute.standard.*;
    javax.print.event.*;

    Hi ,
    I am getting the following error when accessing the DOCFlavor method of the javax.print package.I am using j2sdk1.4.1_02.I am in urgent need of this code.Please help
    D:\JavaSCTest>javac PrintToStream.java
    PrintToStream.java:16: cannot access javax.print.DocFlavor
    bad class file: c:\j2sdk1.4.1_02\jre\lib\rt.jar(javax/print/DocFlavor.class)
    class file has wrong version 48.0, should be 47.0
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    DocFlavor flavor = new DocFlavor("image/gif","java.io.InputStream");
    ^
    1 error

  • Extendingng the javax.print.attribute.standard

    Hello All,
    How do I programatticaly invoke a feature in a printer using Java Print Service API which is currently not available as of now in javax.print.attribute.standard package.The API documentation speaks about extending the Attribute class for the new feature or for a new value for the existing attribute.
    I am feeling stuck when i want to implement 'Reverse order printing' . This feature is not currently supported in the standard JDK.
    How do I go about it?
    We have a workaround if we use java.awt.Printable interface and manually reverse the pages. But I want the printer to take care of the actual reversing of the data.
    Appreciate if anybody can help me on this.
    thanks in advance
    Sinoj.

    You get out your printer manual and check if your printer will do this or not, if it does, then look up the codes that the printer requires to do that task. If it doesn't do it, then go buy a printer that does support it and look up the codes that the printer requires to do that task. Once you have the codes that are required to do that task, then check if there are any special signals (pin activations and etc) that need to be sent to enable that mode. If there are no special signals that are needed to enable that mode, then send the codes to the printer. If you need special signals, then your probably looking at a JNI module for your project to generate the special signals needed.

  • Javax.print postscript support

    The DocFlavors supported by the print services I've queried using the javax.print package haven't included the specific Postscript DocFlavor. They all return the autosense DocFlavor though. Some of these printers will automatically detect and print postscript and some won't but I haven't been able to tell until I actually send the print job to the printer. How widely supported is postscript on current printers or where can I go to find this information? Are there other ways to determine programmatically what formats a printer supports?

    Hey how you find in answer for this yet please let me know as soon as possible thanks.

Maybe you are looking for

  • Creating a "more" button on the menu bar when the menus are more

    Hi, I wanted to create a functionality similar to that we can see in eclipse editor. when we open files more than a number, only some of the pages are visible on the editor. we can access the rest from the button which shows the names of files. I am

  • SQL Query doubt

    Hi, I have a Customer info table Table1 it has the following fields apart from many other fields like cust account info. Account_number Tax_id Tax_ID_format (this field has values S, T and the column is NUllable. I need to find all the tax ids that h

  • Servlet Threading

    I have written a servet that takes in all the request parameters from a Front-End HTML Form. I want to make this servlet Multi-Threaded so that concurrent users can enter data in the Form and this should be handled by the servlet. Can any one please

  • 2 new users, same account

    My roomate and I have one computer that we share and use the same e-mail address. She bought a new ipod and registered it under the new itunes account I created. I now have a new ipod and wish to register it under the same account I created in the fi

  • Workflow/outlook express

    Hi guru    I have made a workflow for PO.Its working fine.Now my requirement is i have to get mails in outlook express also.Is it possible,Guide me please Thanks in advance Balaji