Headless Printing

I have a new website that performs all the shopping functions, credit processing, autoamted order entry, inventory checking, job order scheduling and packing slip creation. So far so good.
My issue is that I would like the system to automatically print reports (i.e. a customer order and related job order(s)) directly to a printer. There would be no preview, as a matter of fact there won't even be a person there. The goal is that once an order is generated and automatically entered, I want the order report to print on printer x.
It then checks inventory and generates the required job orders. I want these to automatically print on printer y.
It is also needed to print a packing slip on printer z.
I'm used to printing in java from swing, but I'm looking for headless operation.
So...
1. What is the best way to get the data sent to the printer. Am I going to need to do some offline component that is formatted and then prints?
2. How can I initiate a print job from the server without presenting a Windows printer dialog box?
Any help would be greatly appreciated.

Thank you all for you assistance thus far (sarcasm alert going off).
So I've elected to go the headless route, creating a Printable object that will be responsible for rendering, etc.
Here's my trick, when trying to use this fancy little report generator from an AWT or Swing test program, it works great. Prints my pretty little report to the printer of my choice with no user intervention. Perfect....
Unfortunately when I try to run it from a Servlet on Tomcat (running on my same test machine as the AWT and Swing test programs....) I get the following exception:
java.awt.print.PrinterException: No print service found.
     at sun.print.RasterPrinterJob.print(Unknown Source)
     at sun.print.RasterPrinterJob.print(Unknown Source)
     at net.foamtapes.printing.Report.printHeadless(Report.java:115)
     at net.foamtapes.printing.Report.printReport(Report.java:93)
     at net.foamtapes.printing.OrderVerificationReport.generateOutput(OrderVerificationReport.java:116)
     at net.foamtapes.printing.OrderVerificationReport.<init>(OrderVerificationReport.java:57)
     at net.foamtapes.printing.ReportTester.doGet(ReportTester.java:22)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
     at net.foamtapes.filters.ServletFilter.doFilter(ServletFilter.java:62)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
     at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
     at java.lang.Thread.run(Unknown Source)Ant help would be greatly appreciated.

Similar Messages

  • Trying to share a printer attached to a PPC Mac Mini

    Hi all.
    I'm reinsterting an old Mac Mini running OS X 10.5.8 as a headless print server. I can interact with it via other computers to share the screen, so my network protocol with the computer is sound. My problem is, I can't seem to print to any printer attached to this computer--this is obviously a problem, as that's the whole reason I've revived this device.
    Sharing setup for all computers is complete and the client computers don't seem to have any trouble seeing the printer. But when I print to it, the job is sent VERY quickly (suspiciously so) from my clients (a Mac Mini Intel in the living room and a MacBook), and the PPC mini shows no indication a print job was ever delivered.
    Any brilliant ideas? I'm sure it's something really basic I'm not remembering or thinking about, and I'm sure someone has already asked this question; feel free to direct me to that solution, as my searching efforts didn't produce anything that I felt was helpful--but I've been wrong before.
    Thanks!

    OK then, please post a brand new question in the OS X 10.5.8 "Leopard" forum:
    https://discussions.apple.com/community/mac_os/mac_os_x_v10.5_leopard
    I no longer have a Leopard system to test and I used my one brilliant idea for today.
    A new question should solicit more interest. Hopefully one of the old guard can think of something. Reference this thread so they can read what you did so far: Trying to share a printer attached to a PPC Mac Mini
    Edit: Before you go, can you print to this printer while directly attached to the other computers too? Make sure it's not a simple driver problem. Good luck!
    Message was edited by: John Galt

  • Print to network printer on Headless Unix box

    Hi
    I have written an app which prints an image on the default printer of a headless unix box.
    I have been told that if I which to extend my app to print my document to a named network printer, I will need to get additional software. Is this true?

    I think you want PrinterJob.lookupPrintServices. Find the PrintService you want and create a PrinterJob from that.

  • {SOLVED}SAMBA/CUPS Printer gone on both Linux and Windows Computers

    Greetings all,
    Have found myself in a pickle that has got me scratching my head.
    For a while now, I have had a headless server set up with Arch Linux with SAMBA and CUPS installed.  All computers in the house have had the printer set as default and have been working fine.  Have not had to print anything in about a week.  Wife went to print a coupon and told me that it would not print.
    I went to my Windows computer and sure enough, the printer no longer even shows up on the network.  I have not touched my smb.conf or changed any CUPS parameters so I am stumped why the printer is no longer accessable.
    When I go into my CUPS Web Interface it shows the printer and shows it as idle
    Officejet_7300    Automatically setup by HPLIP        HP Officejet 7300 Series, hpcups 3.12.10a    Idle
    Here is my smb.conf which like I mentioned earlier has not been touched.
    #======================= Global Settings =====================================
    [global]
    log file = /var/log/samba/%m.log
    printer = HP_7400
    guest account = nobody
    load printers = yes
    printing = cups
    server string = Samba Server
    path = /var/spool/samba
    workgroup = WORKGROUP
    hosts allow = 192.168.0. 192.168.1. 192.168.2. 127.
    security = share
    max log size = 50
    ; printcap name = /etc/printcap
    ; printcap name = lpstat
    # These scripts are used on a domain controller or stand-alone
    # machine to add or delete corresponding unix accounts
    ; add user script = /usr/sbin/useradd %u
    ; add group script = /usr/sbin/groupadd %g
    ; add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
    ; delete user script = /usr/sbin/userdel %u
    ; delete user from group script = /usr/sbin/deluser %u %g
    ; delete group script = /usr/sbin/groupdel %g
    #============================ Share Definitions ==============================
    ;[homes]
    ; comment = Home Directories
    ; browseable = no
    ; writable = yes
    ;[Profiles]
    ; path = /usr/local/samba/profiles
    ; browseable = no
    ; guest ok = yes
    [Storage]
    comment = Home Data Storage
    path = /home/storage
    valid users = ichase ian sharon
    public = yes
    writable = yes
    browsable = yes
    create mask = 0777
    directory mask = 0777
    [printers]
    comment = All Printers
    path = /var/spool/samba
    browseable = yes
    Set public = yes
    guest ok = yes
    writable = yes
    printable = yes
    The Storage drive is still accessable by all computers in the house.  This would be a piece of cake if I had actually gone in and changed something but nothing has been changed.  Not sure when the printer decided to take a hiatus.
    Thanks as always for your help and if there is any other files or command output I can provide, let me know.
    Ian
    Last edited by ichase (2012-12-14 23:27:04)

    ewaller - good point, I actually did try shutting down the printer and turning it back on.  But to no avail.  I may not have touched any of the configuration files but I have run updates on the server via secure shell from my laptop.  So one of the updates may have caused this issue.  I believe that maybe the HP driver may have been updated and that could be the issue.  May need to look at going back to the older version of the driver.
    WonderWoofy - Thanks for the response, as mentioned above (and actually it just came to mind when I was typing it) the updated driver may have caused the issue.  Drivers and support has come a long way in regards to Linux though there is definitely more work that can be done.

  • JTable in Headless Mode

    Is it possible to create a JTable (with the table header) in headless mode?
    Thanks,
    Steve Sinai

    You don't know what headless mode is??? Then you're in the majority. It's one of those things I've seen mentioned in Swing books, but I've never had to deal with it before. On a server, we're trying to fill JTables with data, and then convert the JTables to pdf using iText. If you're wondering why we don't go straight to pdf using iText, thus bypassing JTables, you'll have to talk to our architect.
    An explanation of headless mode is at the following link.
    http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/
    I stole some example code from that site, and have been trying to use it to create a JTable. It's below. Some code that creates a JLabel works fine, and I commented it out. Now I'm trying to get it to create a JTable. The example displays the output on a printer, which is a little bit of a hassle, but it is what it is. If anyone can get the table (with header) to show up, it would be pretty nice.
    import java.awt.*;
    import java.io.*;
    import java.awt.print.*;
    import java.util.*;
    import javax.swing.*;
    public class HeadlessBasics
        public static void main(String[] args)
            // Set system property.
            // Call this BEFORE the toolkit has been initialized, that is,
            // before Toolkit.getDefaultToolkit() has been called.
            System.setProperty("java.awt.headless", "true");
            // This triggers creation of the toolkit.
            // Because java.awt.headless property is set to true, this
            // will be an instance of headless toolkit.
            Toolkit tk = Toolkit.getDefaultToolkit();
            // Standard beep is available.
            tk.beep();
            // Check whether the application is
            // running in headless mode.
            GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
            System.out.println("Headless mode: " + ge.isHeadless());
              /**     The JLabel works.
                     final JLabel c = new JLabel("I'm a Label!");
                     Dimension dim = c.getPreferredSize();
                     c.setBounds(0,0,dim.width,dim.height);
                     Vector data = new Vector();
                   for (int i = 0 ; i < 5 ; i++) {
                        Vector row = new Vector();
                        for (int j = 0 ; j < 4 ; j++) {
                             row.add(i+","+j);
                        data.add(row);
                   Vector columns = new Vector();
                   for (int i = 0 ; i < 4 ; i++) {
                        columns.add("Col "+i);
                   JTable table = new JTable(data, columns);
                   final JScrollPane c = new JScrollPane(table);
                   Dimension dim = c.getPreferredSize();
                   c.setBounds(0,0,dim.width,dim.height);
            // Print system is available.
            PrinterJob pj = PrinterJob.getPrinterJob();
            pj.setPrintable(new Printable()
                public int print(Graphics g, PageFormat pf, int pageIndex)
                    if (pageIndex > 0)
                        return Printable.NO_SUCH_PAGE;
                    ((Graphics2D)g).translate(pf.getImageableX(),
                                              pf.getImageableY());
                    // Paint the canvas.
                    c.paint(g);
                    return Printable.PAGE_EXISTS;
            try
                pj.print();
            catch (Exception z)
                z.printStackTrace(System.err);
    }

  • How do I install the Adobe PDF Pack Desktop Printer

    How do I install the Adobe PDF Pack desktop printer?

    If you’re running the standalone version of FM, then the “headless” Acrobat comes with it; reinstall FM to repair that part. However, if you already had a full version of Acrobat installed, the FM installer may have screwed it up – you’ll have to uninstall all Acrobat(s) and reinstall.

  • Headless problems

    Hello, guys!
    I'm very tired of headless mode...
    I have to create image from JComponent (a big chart inside JPanel) at the server side.
    I've started with simple test progrmam:
    ===========================
    public static void makeTestImage() throws Exception {
    System.out.println("Headless? " + GraphicsEnvironment.isHeadless());
    JPanel panel = new JPanel();
    panel.addNotify(); // Since we have no pack
    panel.setOpaque(true);
    panel.setPreferredSize(new Dimension(300,300));
    panel.add(new JButton("Test"));
    BufferedImage image = new BufferedImage(300,300,BufferedImage.TYPE_INT_ARGB);
    Graphics g = image.createGraphics();
    panel.print(g);
    ImageIO.write(image, "png", new File("test.png"));
    =============================
    I'm running it with : -Djava.awt.headless=true
    Here is output, "Headless? true"
    But new image is just black panel 300x300
    I've tried open exist image and printString there: no problem. But i can not
    export JComponent into image...
    Surprisely, when i've add new method:
    ============================
    public static void paintMe(JComponent comp, Graphics g) {
    int count = comp.getComponentCount();
    comp.paint(g);
    for(int i=0;i<count;i++) {
    if( comp.getComponent(i) instanceof JComponent) {
    paintMe((JComponent)comp.getComponent(i),g);
    else {
    comp.getComponent(i).paint(g);
    ============================
    and insteam of panel.paint(g), calling paintMe(panel,g), sometimes it works!!!
    But not always. And it worked only for 1 panel. If I add new JPanel with some components inside panel,
    I've got HadlessException. It could be fix with set doubleBuffer(false) for new JPanel, but as result: wrong alignment (one component under second...) And it doesn't work always!
    I'me so tired with this task, but it is impossible to ask admin for instaling and running X-server at the UNIX box...
    Could anybody say me, how i can fix my problem ? Or headless is real Head Less for Java 1.4 and i have to use X-emulator or pja lib ?
    Tested platform:
    WindowsNT
    java version "1.4.2_03"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
    Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
    Solaris
    java version "1.4.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
    Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

    I've used headless graphics too; 1.4 should be ok with them
    Though what I haven't done is to use JComponents in headless. I've just created a BufferedImage and drawn to that. Are you sure you need to draw GUI components?
    <guessing mode on>GUIs tend to run in their own threads. The GUI thread gets a repaint event, at which point it redraws. The random behaviour could be from that: sometimes the GUI thread manages to run and repaint, sometimes not. Maybe put a bit of Thread.sleep() in there -- though this would not be an industrial strength solution, as it very much creates a race condition. But if you need to create a few one-off "screen shots" of a program for a manual or something you might get away with it.

  • Linux Issue  - Could not initialize class sun.print.CUPSPrinter

    Afternoon All,
    I am using the latest CR4Ev2.
    Java 1.6 (Am very sure but will double check)
    My Windows enviroment is all working perfectly and so have moved my application over to a Linux setup.
    After solving all my case-sensitivity issues I have managed to get my reports almost working. (I hope almost)
    When the following code is run:
    reportClientDocument = new ReportClientDocument();
    reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString);
    reportClientDocument.open(reportFilePath,OpenReportOptions._openAsReadOnly);
    I get the below error messages in my logging.
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Could not initialize class sun.print.CUPSPrinter---- Error code:-2147467259 Error code name:failed
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.<init>(SourceFile:286)
         at com.businessobjects.sdk.erom.jrc.a.<init>(SourceFile:43)
         at com.businessobjects.sdk.erom.jrc.ReportAgentFactory.createAgent(SourceFile:46)
         at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.<init>(SourceFile:703)
         at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:662)
         at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:632)
         at com.crystaldecisions.sdk.occa.report.application.ClientDocument.if(SourceFile:504)
         at com.crystaldecisions.sdk.occa.report.application.ClientDocument.open(SourceFile:669)
    Now it could just be as simple as we dont have a printer setup on that box.
    Is this a definate requirement. Does the server have to have a printer setup, even if we are only exporting to PDF files.
    I am still doing some testing and since it is the first time getting this far on Linux it might be mistakes on my side,
    but thought I would ask the wide world and see what replies I get back.
    Cheers
    Darren
    Edited by: Darren Jackson on Mar 10, 2010 11:12 AM
    Sorry for the bump but wanted to change the subject to something more enticing

    After many many hours of reading and pulling my hair out I have found a solution to my problem,
    Whether it is a valid solution or a workaround or a cheat I am hoping someone can tell me.
    If I run my application with the switch
    java -jar -Djava.awt.headless=true MyApp.jar
    It works.
    Now I am still doing some investigation on what exactly this headless switch is doing. But it works so I am happy.
    If anyone can give me a technical and or a laymans explanation that would be great.
    All I have to do now is solve my Font issue
    Cheers
    Darren

  • Output on Printer

    I want to a smallest java code which prints "Hello" on printer
    please help me.

    how small? 5-10 lines of code???
    just take a look on the Printable, PrinterJob,, API and how about using it on a headless machines... the shortest way to do that is using the Runtime :) .
    I dont require tutorial
    I only require the smallest possible code.

  • Print using command line

    Hello experts,
    As mentioned in http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm we can use command line instruction to open a pdf file in Acrobat Reader and print it.
    Does anyone know if this works both in Windows and in UNIX?
    Thank you.
    Gie Kian Siauw

    Hi Gie,
    On Unix, you can use commandline instruction to create ps files from the pdf files.
    for eg. "acroread -toPostScript -pairs a.pdf a.ps"
    You can also pipe the ps output to a printer.
    for eg: "acroread -toPostScript -pairs a.pdf - | lp -d <Printer Name>
    This is a headless process of printing pdf files without the launching of acroread.
    The file is not opened in the acroread and just printed.
    Regards,
    Rishi

  • [PARTIALY SOLVED]Can't see SAMBA share or Printer in Linux

    Greetings all,
    I have built a headless server running Arch linux as the base OS.  I am running SAMBA and CUPS and performing all maintenance of this server via SSH.
    The SAMBA share I can see (read/write) on all the Windows 7 machines on the network as well as the Printer connected to the server.  But I can't see it when I open Thunar or PCManFM.  Nor can I access the printer.
    It's obviously something I am doing wrong but I have Googled different parameters trying to find a solution but have come up short.
    Your assistance and guidance in putting me in the right direction is most appreciated.  All my Linux machines are running Arch.
    Thanks,
    Ian
    Last edited by ichase (2012-10-28 07:19:14)

    I have looked high and low.  The printer is set up via CUPS and the printer in smb.conf is set to CUPS.  All 4 windows computers in the house now have this printer set as default and can print fine.
    But if I try to print in Linux, for example in Libreoffice, I get No default printer found.  Please choose a printer and try again.  When I click ok, the network printer does not show up for me to select.
    I have tried updating the /etc/cups/client.conf on the client computer and it is set as:
    # see 'man client.conf'
    homeserver /var/run/cups/cups.sock
    homeserver 192.168.X.XX
    From what I have read so far, this is correct.  When I go to the CUPS Web Interface it shows under Manage Printer my HP 7300 Series printer there and in idle waiting for job.  And in Windows I can print to it just fine.
    As far as I can  tell SAMBA is set up correctly (I can mount the file drive in Arch with no issues) and CUPS seems to be configured correctly as well from all that I have read.
    Any insight would be great,
    Thanks,
    Ian
    Last edited by ichase (2012-10-28 07:28:31)

  • Jdk1.4 printing and AttibuteSets.

    Hi!
    I'm trying to create a HTML -> PS filter, and I'm stumbling on the goal line... I bring up the URL in a HTML component, then use the new 1.4 printing API to write out PS. Unfortunately, my attributes seem to be ignored. I need to set attributes programatically (instead of via a PrintRequest) since my program is headless.
    Time for some code. Here's the actuall attibute handling and printing:
         PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
         // Gray scale only, this is for faxes after all
         aset.add(Chromaticity.MONOCHROME);
         // Try to set right paper and reasonable margins.
         // A4=210x297 mm. 1 cm margins
         aset.add(MediaSizeName.ISO_A4);
         aset.add(new MediaPrintableArea(10, 10, 190, 277, MediaPrintableArea.MM));
         Printable p=new ComponentPrintable(c);
         Doc doc = new SimpleDoc(p, flavor, null);
         pj.print(doc, aset);I'm skipping some of the preliminaries, but everything works except the attributes so I focused on that bit.
    Here's my ComponentPrintable:
    static class ComponentPrintable implements Printable {
        Component component;
         ComponentPrintable(Component c) {
              component=c;
         public int print(Graphics g,PageFormat pf,int pageIndex) {
              if (pageIndex == 0) {
                   Graphics2D g2d= (Graphics2D)g;
                   double x0=pf.getImageableX(), y0=pf.getImageableY();
                   double pw=pf.getImageableWidth(), ph=pf.getImageableHeight();
                   int cw=component.getWidth(), ch=component.getHeight();
                   double sc=((double)pw)/cw;
                   System.out.println("Page dimension: ("+x0+","+y0+")-("+(x0+pw)+","+(y0+ph)+")");
                   System.out.println("Comp dimension: "+cw+"x"+ch);
                   System.out.println("Translate "+x0+","+y0);
                   System.out.println("Scale "+sc);
                   g2d.translate(x0, y0);
                   g2d.scale(sc, sc);
                   component.paint(g2d);
                   return Printable.PAGE_EXISTS;
              } else {
                   return Printable.NO_SUCH_PAGE;
    }Output from the ComponentPrintable when run:
    Page dimension: (72.0,72.0)-(540.0,720.0)
    Comp dimension: 681x1009
    Translate 72.0,72.0
    Scale 0.6872246696035242
    Page dimension: (72.0,72.0)-(540.0,720.0)
    Comp dimension: 681x1009
    Translate 72.0,72.0
    Scale 0.6872246696035242One inch margin. And when viewing the PS file it turns out it's in color as well.
    Why oh why aren't my attributes respected? Any and all suggestions welcomed.

    Well, I was trying to use the unified printing APIs in 1.4, ie. javax.print.DocPrintJob and so forth. If you do it that way there is no PageFormat, just the attributes. In 1.3 style printing there was no way to print to a PostScript file.
    But, lo and behold, I checked out the docs for 1.3-style printing (java.awt.print) in 1.4 and they have added methods to select a StreamPrintService based on output flavor. Then I could use a plain old PrintJob and PageFormat to fix the margins.
    I'll give you partial credit for leading my right. However, I also need to get grayscale to work. The client's PS printing program crashes on 'textcolor' commands. :-(
    Finished code if anyone is interested:
    String psMimeType = DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType();
    PrinterJob pj = PrinterJob.getPrinterJob();
    StreamPrintServiceFactory[] factories =
         PrinterJob.lookupStreamPrintServices(psMimeType);
    if (factories.length == 0) {
         System.err.println("No suitable factories");
         return false;
    try {
         FileOutputStream fos = new FileOutputStream(f);
         StreamPrintService sps = factories[0].getPrintService(fos);
         pj.setPrintService(sps);
         PageFormat pf=pj.defaultPage();
         Paper p=new Paper();
         p.setSize(210*72d/25, 297*72d/25);
         p.setImageableArea(10*72d/25,10*72d/25, 190*72d/25,277*72d/25);
         pf.setPaper(p);
         pj.setPrintable(new ComponentPrintable(c), pf);
         pj.print();
    } catch (Exception x) {
         x.printStackTrace();
         return false;
    return true;

  • JDK1.4 headless vs xvfb vs PJA

    I need to generate images on a Solaris box without an X11 server.
    As far as I know, my options are:
    - PJA
    - xvfb
    - JDK1.4 in headless mode
    I have tested PJA and it is very slow.
    Has anyone tested server side image generation using xvfb or JDK1.4 in
    headless mode? Which is the fastest? How do they perform compared to
    running X11?
    Thanks,
    /Mattias

    Here is how you can do this if you are using the jakarta tomcat 4.0.x
    export CATALINA_OPTS="-Djava.awt.headless=true"
    Alternatively you can do this in your code (most suitable place is the init() method of your servlet
    System.setProperty("java.awt.headless", "ture");
    Both the things worked for me. Just to be sure if the sytem propety is set properly check it with
    System.out.println("Headless is " + System.getProperty("java.awt.headless");
    If it prints true, every thing should work fine. If it false or null means there is some thing wrong.
    Note: - Dont use the JAVA_OPTS of the tomcat cat. It looks there is a bug in the startup script (Or atleast I dont know how to use that option ).
    Thanks
    Raj Saini

  • Turn Scanner + Printer + Linux computer into a copier?

    I have a scanner and a printer, both supported on Linux.
    What software can I use to automate copying of a sheet of paper, first scanning it, if necessary apply a threshold filter and then printing it?
    Restrictions:
    * no X necessary, the server (a beagle board) runs headless
    * Only one LED for status information and one button to start the fully automatic process
    That's how I imagine the work flow:
    1. scan using sane (What cli front ends can you recommend me for sane? scanimage?)
    2. if necessary, apply a threshold filter to get rid of noise and improve legibility (depends on quality of scanner output)
    3. print using lp or lpr
    Has anyone experience with a similar setup or knows any existing application to do the job?

    Thanks a lot for your answers! And to think I wanted to use an old gamepad as input device when there are plenty of buttons on the scanner.
    Googling scanbuttond brought me to an article about scanner buttons at the Gentoo Wiki.
    Depending on your scanner model, the sane backend might support button presses, in my case (sane-pixma) I have to add the --button-controlled=yes option to scanimage. The information is in the man page.
    I'll have a look at the example script, too, for further inspirations.

  • Printerjob, awt headless mode and mac os x server

    hello
    i've an application that print a page using classes like jframe, jpanel, jtable, etc
    when i run it on a linux server or on a windows one there are no problems, but when i try to print this page on mac os x server 10.6.8 i get this error:
    on system dock appear a java icon named org.apache.catalina.startup.Bootstrap and the printed page comes empty. if i set the visibility property to true i can see the correct page, but i can't print!
    I've searched on google and i found various articles that say to set JAVA_OPTS to awt headless = true. i've tryed but i've obtained an headlessexception, because i use jframe etc that need headless mode disactive...so what can i do?
    i want to print with a shared network windows printer, if i print with textedit all go well, the problem appears only using java PrinterService class
    thanks in advance

    Paolo - Welcome to Discussions!
    At the moment - this is partly implemented.
    Networked home directories only are searched (new to tiger)
    Although there appear to be stubs of routines (and some low level documentation) that seem to point to support for indexing entire shares, it is not enabled.
    I know your case seems like a good one for this - but in general, it makes little sense for a lot of clients to hammer a network volume - all of them making their own index. I would presume there is a plan to allow the server to make one index and have the clients either refer to that index or download a copy of that index as needed to reduce the overhead on the server... (but that's just an educated guess - with no way of knowing)
    For more information, see http://docs.info.apple.com/article.html?artnum=301533 and http://discussions.apple.com/message.jspa?messageID=1303423#1303423

Maybe you are looking for

  • Time total in script logic

    hi,   i am using bpc 7.0 MS sp 2   i have a situation where i need to do a simple formula using only 2 dimensions, i.e. account and time.   the formula goes like this: (accountA, time monthA) - (accountB, aggregate of Jan till Dec of the year shared

  • FCSS1 and Leopard - apple supported!

    Contrary to an earlier post by someone, if you look at http://docs.info.apple.com/article.html?artnum=307092 it is clearly stated that whilst FCP 4 (and earlier) is not supported FCS1 and FCS2 are! Final Cut Pro 4: Not supported on Mac OS X 10.5 Leop

  • How to search XML

    When i search for the attribute (levelid) "3". How to write the code var xml:XML=<leval0 layput="Menu">   <level label="s" type="level" levelid="1"/>   <level label="a" type="level" levelid="2"/>   <level label="b" type="level" levelid="3"/> </leval0

  • Session host changes to custom Windows theme

    One of our session host servers (2012 R2 with Desktop Experience installed) has recently been changing themes to a custom one instead of the Windows default. The issue is this custom theme contains some high contrast settings that paradoxically make

  • Everything but calendars sync on my ipad!?

    After I upgraded to IOS 5.5 on my iPad (1) my calendars dissapeared on the iPad. Everything else syncs just fine, and the calendars is available on my other computers/iphone/icloud.com. There is no errors or anything else that I can find - its just l