Print same output to all printers

i am using :
import java.awt.*;
import javax.swing.*;
import java.awt.print.*;
import java.awt.image.BufferedImage;
import java.awt.geom.Rectangle2D;
public class PrintUtilities extends Thread{
public static final double MM_TO_PAPER_UNITS = 1/25.4*72;
public static double widthA4 = 210*MM_TO_PAPER_UNITS;
public static double heightA4 = 297*MM_TO_PAPER_UNITS;
public static double leftMargin = 4.0*MM_TO_PAPER_UNITS;
public static double topMargin = 4.0*MM_TO_PAPER_UNITS;
public void run()
//setDaemon(true); // this thread will not keep the app alive
print();
private Component[] componentsToBePrinted;
public static void printComponent(Component c) {
new PrintUtilities(c).print();
public static void printComponents(Component[] c){
     new PrintUtilities(c).print();
public PrintUtilities(Component componentToBePrinted) {
this(new Component[]{componentToBePrinted});
public PrintUtilities(Component[] components){
     this.componentsToBePrinted = components;
public void print() {
     PrinterJob job = PrinterJob.getPrinterJob();
     PageFormat pf = job.defaultPage();
     pf.setOrientation(PageFormat.PORTRAIT);
          Paper paper = pf.getPaper();
          paper.setSize(widthA4, heightA4);
          paper.setImageableArea(leftMargin,topMargin,widthA4-2*leftMargin,heightA4-2*topMargin);
          pf.setPaper(paper);
          job.setCopies(1);
     //     job.setCopies(PrinterJob.getPrinterJob().getCopies());
     Book bk = new Book();
     for(int i=0;i<componentsToBePrinted.length;i++){
          System.out.println("APPENDING THE FOLLOWING DOC NUMBER: "+i);
//          disableDoubleBuffering(componentsToBePrinted);
          bk.append((Printable)componentsToBePrinted[i],pf);
               //enableDoubleBuffering(componentsToBePrinted[i]);
     job.setPageable(bk);
     //TODO pass an appropriate/specific name for the print job
     job.setJobName("Mobile Report Print Forms");
     if (job.printDialog()) {
     try {
     job.print();
     } catch (PrinterException e) {
     System.out.println(e);
/** 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);
i am getting different output on different printers as well. I have classes defined as Printeable that draw forms, each form has 75 questions and they are all done using graphics2D some printer prints all the pages perfectly some other with different margin and on a laser printer i get only one box.
If it helps someone, for testing, i printed to file (.prn) and read the ouput through Red Titan it's free
it showed me one box out of 76
just the first one ????
possible solution that would help for margin
http://java.sun.com/developer/JDCTechTips/2004/tt0611.html
i used book and send printeable class and appended them into the book class
i am dying to solve this problem and wondering if there is better way for testing and how to make all pages
compatible for all printers. I want my program to send all forms to printer same format same size
is there any suggestion?? what am i doing wrong?
by the way
bk.append((Printable)componentsToBePrinted[i],pf);
componentsToBePrinted[] is an array of classes that implements Printeable and they all draw the forms correctly and sends to the printer. It is working mostly but i needed to work on alll printers no exceptions
I appreciate any help and i will issue all my duke starts im new to posting in the forum but i will give all my points for this tip
PLEASE HELP

I want my program to send all forms to printer same format same size is there any suggestion??Produce a PDF... effectively delegating printing there-of to someone else. Problem solvered.
Your PDF options are (AFAIK) FOP or itext.
Cheers. Keith.

Similar Messages

  • Need to print same outputs at different printers

    Is there any way we could have the output directed to a different printer. A sales order confirmation output needs to print at printer ABC for user Sam, and printer xyz for user Jude. What configuration change would allow printing of outputs at user specific printer.
    Any suggestions

    if it is printing immediately , yes it is possible. In the user profile( T Code SU01) have default printer assigned , which ever you want to print for specific user and click on output immediately. when  the order is saved then it will print to the printer maintained in the user profile.
    If batch program , then itwill be difficult
    Regards
    Sai

  • My Macbook pro OS 10.10.2 suddenly will not communicate with my Cannon MX890 printer.  I reset all printers and now I cannot seem to add a printer by using the Add a printer function.  Ideas?

    My Macbook pro OS 10.10.2 suddenly will not communicate with my Cannon MX890 printer.  I reset all printers and now I cannot seem to add a printer by using the Add a printer function.  Ideas?

    The appearance of the printer in the Default view of the Add printer window relies on a protocol called Bonjour. There have been quite a few users who upgraded to Yosemite only to find that their wifi printer is no longer visible. Until Apple resolves this issue you can add your printer using the LPD protocol. To do so you will need to determine the IP address being used by the MX890. This can be done via the touch panel under Device Settings > Network Settings.
    Once you learn the IP address then on the Mac you can click to add the printer and select the IP icon. Here you can enter the IP address, set the Protocol to Line Printer Deamon and leave the Queue field blank. Then change the name to Canon MX890 and in the Use menu, browse for the Canon MX890 series driver. Then click Add to complete the printer creation.

  • Need to print an output on two printers simultaneously

    Hi All,
    We have a requirement to print a spool on 2 printers simultaneously. Can this be done??
    Please respond.
    Regards,
    Sharadendu

    Proposal:
    get the print parameters by fm GET_PRINT_PARAMETERS
    it will fill a structure type PRI_PARAMS
    change PRI_PARAMS-PDEST to printer1 and send output to spool:
    new-page print on parameters PRI_PARAMS no dialog.
    change PRI_PARAMS-PDEST to printer2 and send output to spool again

  • Printing same document to different printers results in differint number of pages

    Hello - when I print a form, created in a custom application, to an HP 1160, it prints on 4 pages.  When I use the same computer and application to print the form to an HP 1320, it prints on 3 pages.  The form was designed to print on 3 pages, and when I compare the 4 page printout to the 3 page printout, the font size on the 3 page  printout is slightly smaller.  Is there anything I can do, short of replacing my 1160 printers with 1320s?
    Thank You

    First of all, you can't use Adobe Reader to add, delete or duplicate pages in a PDF file (unless you use a template object), so you're either using Adobe Acrobat, or some other application entirely.
    The size of PDF files is not linear, ie if you have 1-page file and it's 1 MB, then duplicating it will results in a 2-page file of 2 MB, or a 10-page file of 10 MB. Many items in a PDF document only need to be saved once (such as font information, image information in some cases, etc.), so the change in size when adding additional pages is sometimes very small. At other times it can be very big, though. You can have a 100-page file that is 1 MB and then add a single page to it, with a new font perhaps, and the size will jump to 5 MB, just because that font is very large...

  • Smart form printing same data  in all the 10 pages for tcode va03

    Hi Experts
    with tcode va03 i am taking print preview of sales document when i go for print preview it is showing all the 10 pages
    with line items but when i take print for all 10 pages it is displaying first page data in all the 10 pages
    i had checked with basis consultant regarding print problem it is fine from their part
    what can be the reason
    Thanks & Regards
    anu

    Hi Anu,
    Welcome to SDN.
    In hope your Sales Document Print Preview is a Smartform. So, in the Smartform first page check for the next page assignement. Also, debug your Smartform for any issues with reference to the looping of data.
    Regards,
    Pranav.

  • Print Formatting Problem On Specific Printers

    When printing an ABAP list in LOCL mode, on certain printers the grayscale backgrounds of fields print as slashes ////// and others print as crosshatched.
    For example, on a Canon 2200 printer,
    this code prints as crosshatched background behind the text:
          WRITE: / 'INSTALLATION:',
          15 GSTR_REP-ANLAGE COLOR 6 INVERSE ON.
    This code prints as slashes in background, behind the text:
          FORMAT COLOR 5.
          WRITE 'Write some text'.
          FORMAT COLOR OFF.
    On an HP 8150 printer, the same report prints a grayscale background for the color 5 example, and a plain background for the color 6 example.  It does not matter which output device is chosen, the output is the same.
    Any ideas on how to resolve this, so the report prints the same way on all printers?
    Thanks

    It really all depends on the printer drivers being used for each model of printer.  I would say that if you want all the printers to print the same,  buy all they printer model.  I know that this is not realistic,  but I think that you are stuck with what ya got.  I don't know if changing the print device attributes at the OS level of SAP will help or not.
    Regards,
    Rich Heilman

  • No printing :I can't print anymore, printing the same file with another programs is ok, printing form LR: Preparing  and Printing indicatorbar in the left hand upper corner are running, but no output at all rom my printer. I have been printing before. I u

    No printing :I can't print anymore, printing the same file with another program is ok, printing form LR (in the same system and printer of course :-) ): Preparing  and Printing indicatorbar in the left hand upper corner are running and completing, but no output at all to my printer. I have been printing before. Next I upgraded to LR5.7.1 but the problem stays. Perhaps some adjustment is changed by me unintentionally, but I have no idea. Does anybody know what to check? Printing to file is also strange,the canvas only seems to accept A4, and crops any image relative to that size, so a 10x15 cm print on 10 x 15 cm paper is cropped to 10x15/2. Anybody any idea? (system win 8.1 64, printer HP B8550)

    I accidentally solved my mystery.  For some reason it was set to "print to file".  I changed it to "printer" and now I am able to print.

  • Two print programs using the same output type in t-code v/40

    Hi,
    I am trying to use the same Output type RD00 to print diferent forms.
    In t-code v/40 we can fill a second Processing but how this work?
    Can someone tell me more about this?
    The final goal is to print diferent forms according to different companies.
               Thank you and best regards
                         João Fernandes

    Hi,
    It is not possible to have 2 different routines to be assigned to one output type in the procedure. I think when you say 2 routines, you are saying 2 logics or you are saying the subroutines KOBED and KOBEV of the routine.
    In all reqmt routines, which is in discussion now, only one of the subroutines will be always called, though I dont know unfortunately which one is this. As you said, that only one of your processing logic works, that is the right subroutine area where the second logic should also be coded. So please move your code from the inactive subroutine area to the active subroutine area. Now you should be able to see both the validations being active.
    Hope this helps. If the case is different, please let us know.

  • Two printers need to be setup for same output type

    Dear Experts
    How do we create condition records for two different printers in VV61 with same output type and packing material type?
    Thanks in advance for your answers.
    Regards
    Bala

    3)
    The configuration helps to redetermine the printer.
    F1 help for the field:
    "Description of print profile
    By specifying a print profile, the printers for output processing are redetermined. You can, for example, assign the printers of a specific packing station to a print profile.
    Using the parameter "PPT", you can individually define the print profile in the user parameters."
    Please note that you also have to maintain the profile for each user.
    2)
    You have to make yourself familiar with SAP's condition technique.
    http://wiki.scn.sap.com/wiki/display/ERPLO/output+determination+using+condition+technique
    (You will need a condition table in which one key field is the plant and assign it to the output type through an access sequence)

  • All printers missing from Print Management

    Okay, so I have a weird issue.  I am running Windows Server 2008 Standard SP1 on my local workstation and used to be able to fully administer all printers in our company via Print Management installed as a feature from Remote Server Administration Tools > Role Administration Tools > Print Services Tools.  One day earlier this week, I lost this ability. 
    All printers literally disappeared.  I can still see drivers, forms and ports, but absolutely no printers.  However, within printers inside Print Management, I can still add a new printer although I cannot see it - but know that it has been added successfully by consoling the respective print server and tested it.  I also am still able to see all deployed printers (via GP) and can still deploy those that have previously been deployed.
    Nothing has changed in terms of security rights (I am a Domain Admin), firewall settings, or Windows Updates.
    The print servers that I connect to are all on the same subnet, and are running Windows Server 2003 R2.
    I've tried removing and re adding the Print Services Tools in Server Manager and tried updated Windows Media Services 2008 via this link. 
    I cannot find anything out on the web indicating a similar issue,  so I am hoping someone on this forum may be able to help.
    If this is a known issue, I must of overlooked the post, so please post the link for me.
    Thank you,
    Bob

    Hi,
    As far as I know, most printer object missing issue can be caused by the printer pruning. This feature is an thread running inside spoolsv.exe on the Domain Controller. It will periodically check if the printer object is valid. After trying several times, if the object always considered as invalid, DC will remove this object form AD.
    To disable printer pruning, we can simply disable spooler service. The only impact is the printing function on DC is not available. But, all the client and printer server will not affected. Client can still search object in AD.
    The following are two policy related to pruning:
    1.      On DC, run gpedit.msc and locate Computer configuration/Administrative Templates/Printers
    2.      Make sure all the pruning related policy is set to disabled
    Disabled the policy "Allow pruning of published printers"
    Enable the policy “Directory pruning interval”, and set the interval to Never
    Regards,

  • Printing Swing components doesn't work on all printers? Please Help!

    I have a really serious problem. I try to print Swing components with the so called PrintUtilities class. The source code can be found here: http://archive.corewebprogramming.com/Chapter15/printing/PrintUtilities.java).
    My Swing components are panels (JPanel) including more panels and/or other components like text fields, text areas, combo boxes, radio buttons, check boxes and so on.
    On one of my printers (Kyocera mita FS 1010) it works fine. But on other printers (Panasonic DP-2000, HP Deskjet 890 C) the results are weird: Only the first component (independent of the component depth) is printed (and it is every time the same result!).
    I don't know whether this is important or not, but all printers I use are installed as network printers.
    I have already searched the forum but couldn't find a similar problem.
    Can anyone tell me what the problem is and what I can do to solve it?
    Thank you for any response in advance!

    try this:
    package ayto;
    import java.awt.*;
    import java.awt.print.*;
    import javax.swing.JComponent;
    public class ComponenteParaImprimir
    implements Printable {
    private Component mComponent;
    boolean isBook;
    final static boolean PARA_BOOK = true;
    final static boolean HARDCOPY = false;
    public ComponenteParaImprimir(Component c, boolean book) {
    mComponent = c;
    isBook = book;
    public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
    if (pageIndex > 0 && !isBook) {
    return NO_SUCH_PAGE;
    Graphics2D g2 = (Graphics2D) g;
    g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    boolean wasBuffered = disableDoubleBuffering(mComponent);
    mComponent.paint(g2);
    restoreDoubleBuffering(mComponent, wasBuffered);
    return PAGE_EXISTS;
    private boolean disableDoubleBuffering(Component c) {
    if (c instanceof JComponent == false) {
    return false;
    JComponent jc = (JComponent) c;
    boolean wasBuffered = jc.isDoubleBuffered();
    jc.setDoubleBuffered(false);
    return wasBuffered;
    private void restoreDoubleBuffering(Component c, boolean wasBuffered) {
    if (c instanceof JComponent) {
    ( (JComponent) c).setDoubleBuffered(wasBuffered);
    }

  • Firefox 4.0 (final released version) not printing on different computers and printers preview same way prints only url on top of pages

    This is happening on different OS's Win 7, Win XP, Win Vista (32 & 64 Bit) OS's and various printers HP, Lexmark that we have at several different sites where we have computers. This happens on locally installed printers (LPT1, USB) and IP networked printers. ALL printer drivers are current and worked correctly under Firefox 3.6.15. Print previews show the correct printers but only shows the URL's on the top of the pages which is all that prints, it even happens on when trying to print pdf's. This is happening on all fifty computers that we have that have been upgraded to ver 4.0 from ver Firefox 3.6.15. Updates made within FF update tool. Same thing happens with all add-ons disabled on all computers. Read all knowledge base items on printing problems none helpful. Obviously, something is not working right. Any suggestions?

    Is there anyone who might be able to offer some suggestions on this issue, please?
    I posted this question/issue 48 hours ago, and it's floating downhill in the queue without any replies. I am still paralyzed, unable to print.
    Bob Headrick, I notice that you are omnipresent on this forum, and also very knowlegeable. May I ask for your thoughts on this issue?  I believe I've followed all the rules here--posting the specifics of the problem, the model numbers and configurations of all equipment, the software involved--but if I've failed to follow forum protocol in any way, please let me know and I'll do my best to post the information you need. I'm sorry to call you out by name, but I'm unclear on how to get help, and I'm at a loss for a solution to this issue.
    Thanks in advance to Bob and/or anyone else who has a moment to help on this incredibly frustrating issue.
    --Jeff

  • Invoice Print and Email from same output type

    Hi All,
    We want to print invoice and send an email to customer. Can this be acheived using same output type??
    If yes, plz guide how can we do this..
    I check some queries in forums but they had coding etc.  Can we do it with config??
    Regards,
    Satish.

    I'm not sure why you wouldn't configure two output types. However, you can do this with one output type in a number of ways:
    1. Use a speciial function output (transmission medium 8).
    This allows you to write ABAP code to anything you want. However, you have to manage print contols on yur own as the special function transmssion medium doesn't allow you to specify these on he condition record.
    2. Change the driver program for the print output for the output to send emails.
    You would need to handle the email routing on your own because the output records for print are just for printing.

  • Adobe deletes all printers (every printer!!), then can't add printer

    When trying to print one particular file (others are okay), the Adobe pdf printer will hang. When I then go to Devices and Printers, all printers are missing, included non-USB printers (fax, HP 1020, Epson 1280, MS XPS document writer, Quicken PDF Printer). When I try to add a printer, I get the message that Printer Spooler has stopped running and so I cannot add a printer. All attempts to restart the printer spooler fail (the usual stuff in tried per support forums). Naturally, I cannot print from any other application now since there are no longer any printers installed. Restoring to a previous restore point fixes everything until I try to use Adobe to print the particular file again.
    Here's a link to the offending file:
    http://www.dutchessfair.com/downloads/2010-DCF-Program.pdf
    Upon a restore, all my printers were back so I tried printing the pdf file above again and got the same result a second time. Since I got tired of doing restores, I didn't try a third time.
    My system:
    Win 7 64 bit, updated to latest level
    Adobe Reader updated to last week (minus the most recent update)
    Inter i7 920
    Mainboard MSI X58 Platinum
    BIOS American Megatrends V1.5 (4/20/2009)
    Memory 6144 Mb, triple channel
    Graphics: Radeon HD 4850
    Any idea what's going on???
    Regards, Bob

    WHAT IS WITH THIS!
    Couple times now this happenned on the bosses PC. He went to print a PDF file he received as a attachment and lost all printers. We could not restore the printers one time, had to get some expert PC help to get them back. Other time, deleted files stuck in printspooler, restarted and got printers back.
    Windows xp
    Now, just happenned to me running windows 7. Adobe 9.3.4 running. Opened the .pdf file just fine, but when I go to print it all my printer devices are gone.
    Rebooted, printer devices reloaded. Opened the .pdf again and bamm! All the printer devices are gone again.
    I had been printing other .pdf documents with no issues. Why is it that certain .pdf files corrupt my system?
    What is wrong with READER??  What/Where is the fix??
    I need to print this document/
    Looking at the prior respopnses, I am probably dreaming thinking I will see a fix here...
    J

Maybe you are looking for

  • Disappearing scrollbar in Mac OS 10.8

    I recently upgraded my Mac operating system from OS 10.6 to OS 10.8. After doing so I found that the scrollbar on my Verizon email page had disappeared so it was impossible to click on messages at the bottom of the page. This was the case whether I a

  • Access FLV metadata from Spark VideoPlayer

    Is there any way to access FLV metada in Spark VideoPlayer? There was metadataReceived event in past. But now there is no any event for metadata. Thank you

  • Model Binding and Calculated Field Syntax for "class" Attribute

    Hi, I tried to use the calculated field syntax from SAP UI5 to change the CSS class attribute of an element based on some model property, i.e., I wanted to change the class in the corresponding formatter function based on the currently bound value. H

  • Which release procedure will pick?

    Can any body help? We have a requirement that ,for same material (ABC)  but belongs to different plant, we have two release strategies R1,R2 R1:-in this strategy two codes assigned This release strategy will effect when net value=50000 & plant "X" R2

  • Shared calendars are inconsistent

    Hi all. I share a few calendars with my daughter.  In iCal on my iMac, all the calendars are in the [email protected] section.  She has a @me.com email account and also @hotmail.com email account.  We realized yesterday that all the notification emai