1 Reply Latest reply: Dec 11, 2011 3:08 PM by 860088 RSS

    Printing properties problem

    860088
      Hi everybody... This might be lame, but i'm stuck with printing. Actually I get the string printed but I wanted to disable the printer dialog box and just print with default settings to the default printer.

      below is the code that i use for printing:
      try {
                  boolean complete = tbPrint.print(null, null, true, null, null, false);
                  if (complete) {
                      tbPrint.setText("");
      
                  } else {
      
                  }
              } catch (PrinterException pe) {
      
              }
      I was searching Google for an example but every example is very very long because includes printing graphics etc.

      Can someone guide me through this problem?

      Thanks in advance!

      Best Regards,
      Dean

      Edited by: dkocevski on Dec 11, 2011 8:35 AM

      Edited by: dkocevski on Dec 11, 2011 8:35 AM
        • 1. Re: Printing properties problem
          860088
          Problem solved! :)

          The code:
          try {
                      
                      String s = tbPrint.getText();
                      tbPrint.print(null, null, false, null, null, false);
                      
                  } catch (java.awt.print.PrinterException ex) {
                      
                      ex.printStackTrace();
                      
                  }
          I set the third attribute of the print() function to 'false' and it doesn't show the printing dialog, just passes the job to the default printer.

          I just need to check the other attributes to see what else can i pre-configure... page size, margins, etc.

          Best Regards,
          Dean