Package java.awt.print

Examples of java.awt.print.PrinterJob


      } catch (PrinterException e1) {
        e1.printStackTrace();
     
    }
    if (spp != null){
      PrinterJob job = PrinterJob.getPrinterJob();
      job.setCopies(1);
      String title = spp.getTitle().getText();
     
      job.setJobName("Spielplan");
      //noch anpassen uhrzeit, datum
     
      /*    // set the Printable to the PrinterJob
       * resulst in some sort of screen shot
          job.setPrintable(new Printable() {

            public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) {
              if (pageIndex == 0) {
                spp.print(graphics);
                return Printable.PAGE_EXISTS;
              }
              return Printable.NO_SUCH_PAGE;
            }
          });*/
      DruckSpielPanel dsp = new DruckSpielPanel();
      dsp.setSps(spp);
      dsp.setTitle(title);
      dsp.setGetPrintInfo(true);
      try {
        job.setPrintable(dsp);
        job.print();
      //  job.setPrintable(dsp); 
        dsp.setGetPrintInfo(false);
        // show the dialog
        if (job.printDialog()) {
          job.print();
        }
      } catch (HeadlessException e1) {
        e1.printStackTrace();
      } catch (PrinterException e1) {
        e1.printStackTrace();
View Full Code Here


      } catch (PrinterException e1) {
        e1.printStackTrace();
     
    }
    if (spp != null){
      PrinterJob job = PrinterJob.getPrinterJob();
      job.setCopies(1);
      String title = spp.getTitle().getText();
     
      job.setJobName("Spielplan");
      //noch anpassen uhrzeit, datum
     
      DruckSpielPanel dsp = new DruckSpielPanel();
      dsp.setSps(spp);
      dsp.setTitle(title);
      dsp.setGetPrintInfo(true);
      try {
        job.setPrintable(dsp);
        job.print();
      //  job.setPrintable(dsp); 
        dsp.setGetPrintInfo(false);
        // show the dialog
        if (job.printDialog()) {
          job.print();
        }
      } catch (HeadlessException e1) {
        e1.printStackTrace();
      } catch (PrinterException e1) {
        e1.printStackTrace();
View Full Code Here

    * Creates a print job for the chart.
    */
   public void createChartPrintJob()
   {

      PrinterJob job = PrinterJob.getPrinterJob();
      PageFormat pf = job.defaultPage();
      PageFormat pf2 = job.pageDialog(pf);
      if (pf2 != pf)
      {
         job.setPrintable(this, pf2);
         if (job.printDialog())
         {
            try
            {
               job.print();
            }
            catch (PrinterException e)
            {
               JOptionPane.showMessageDialog(this, e);
            }
View Full Code Here

    private boolean _doPrintComponentAwt_()
    {

        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable(this);
        boolean blnOk = true;

        if (job.printDialog())
        {
            try
            {
                job.print();
                setCursor(Cursor.getDefaultCursor());
            }

            catch (Exception exc)
            {
View Full Code Here

            if( document.isEncrypted() )
            {
                document.decrypt( password );
            }

            PrinterJob printJob = PrinterJob.getPrinterJob();
            printJob.setJobName(new File(pdfFile).getName());

            if(printerName != null )
            {
                PrintService[] printService = PrinterJob.lookupPrintServices();
                boolean printerFound = false;
                for(int i = 0; !printerFound && i < printService.length; i++)
                {
                    if(printService[i].getName().indexOf(printerName) != -1)
                    {
                        printJob.setPrintService(printService[i]);
                        printerFound = true;
                    }
                }
            }

            printJob.setPageable(new PDPageable(document, printJob));
            if( silentPrint || printJob.printDialog())
            {
                printJob.print();
            }
        }
        finally
        {
            if( document != null )
View Full Code Here

                try
                {
                    if (document != null)
                    {
                        PDPageable pageable = new PDPageable(document);
                        PrinterJob job = pageable.getPrinterJob();
                        job.setPageable(pageable);
                        if (job.printDialog())
                        {
                            job.print();
                        }
                    }
                }
                catch( PrinterException e )
                {
View Full Code Here

    @Deprecated
    public PageFormat getPageFormat(int pageIndex)
    {
        try
        {
            PrinterJob printerJob = PrinterJob.getPrinterJob();
            return new PDPageable(this, printerJob).getPageFormat(pageIndex);
        }
        catch (PrinterException e)
        {
            throw new RuntimeException(e);
View Full Code Here

      if(currentSVGTemplateName == null || !currentSVGTemplateName.equals(svtTemplateName)){
        sVGImagemanipulator = new SVGImageManipulator(new StringReader(sVGData),visualVaildity,hardTokenSerialPrefix);
      }

      if(currentService != null){
        PrinterJob job = PrinterJob.getPrinterJob();

        job.setPrintService(currentService);
        PageFormat pf = job.defaultPage();        
        Paper paper = new Paper();
        paper.setSize(pf.getWidth(), pf.getHeight());
        paper.setImageableArea(0.0,0.0,pf.getWidth(), pf.getHeight());       

        pf.setPaper(paper);        
        job.setPrintable(sVGImagemanipulator.print(userDataVO,pINs,pUKs,hardTokenSN, copyOfHardTokenSN),pf);        
                job.setCopies(copies);
        job.print();                                  
      }else{
        throw new PrinterException("Error, couldn't find the right printer");            
     
    }catch(IOException e){
      log.error(e);
View Full Code Here

        // Graphics g = this.imageArea.getGraphics();
        PageFormat pf = new PageFormat();

        HashPrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();

        PrinterJob job = PrinterJob.getPrinterJob();

        // pf = job.pageDialog(pf);

        boolean ok = job.printDialog(attributes);

        pf = job.getPageFormat(attributes);

        if (ok) {
            try {
                job.setPrintable(cp, pf);
                job.print(attributes);
            } catch (PrinterException ex) {
                /* The job did not successfully complete */
                Logger logger = Logger.getLogger(ImageToolsView.class.getName());
                logger.log(Level.SEVERE, null, ex);
                showError("The print job did not complete " + ex);
View Full Code Here

    public void startPrinterJob(boolean showDialog) {
        //Restore originally configured target resolution
        float saveResolution = foUserAgent.getTargetResolution();
        foUserAgent.setTargetResolution(this.configuredTargetResolution);
       
        PrinterJob pj = PrinterJob.getPrinterJob();
        pj.setPageable(renderer);
        if (!showDialog || pj.printDialog()) {
            try {
                pj.print();
            } catch (PrinterException e) {
                e.printStackTrace();
            }
        }
       
View Full Code Here

TOP

Related Classes of java.awt.print.PrinterJob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.