0 Replies Latest reply: Sep 16, 2010 7:19 AM by 843798 RSS

    Print to XPS > keeps calling print() of cloneable

    843798
      On Print dialog, Select 'Microsoft XPS Document Writer' option from Name dropdown
      click on print
      ON file save as dialog click on cancel buttton
      Application calling print() method of clonable after clicking on cancel button.

      Code

      PrinterJob printerjob = PrinterJob.getPrinterJob();
      if (printerjob.printDialog())
      {
      try
      {
      printerjob.print();
      pgg = null;
      paper = null;
      printerjob = null;
      }
      catch (PrinterException pe)
      {
      System.err.println("Error - Unable to print "+ pe.getMessage());
      }
      }

      public int print( Graphics g, PageFormat pg, int i)
      {
      m_progressBar.setString("Printing Page "+(i+1)+" of " +m_nPageCount);
      int nProgress = (int)(100.0*((double)(i+1)/(double)m_nPageCount));
      m_progressBar.setValue(nProgress);
      m_progressBar.setVisible(true);
      return Printable.PAGE_EXISTS;
      }

      Any one know the reason...........................