Package java.awt.print

Examples of java.awt.print.PrinterException


   */
  public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
  {
    if (Thread.interrupted())
    {
      throw new PrinterException("Current thread interrupted.");
    }

    pageIndex += pageOffset;

    if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
    {
      return Printable.NO_SUCH_PAGE;
    }

    try
    {
      JRGraphics2DExporter exporter = new JRGraphics2DExporter();
      exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
      exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
      exporter.setParameter(JRExporterParameter.PAGE_INDEX, Integer.valueOf(pageIndex));
      exporter.exportReport();
    }
    catch (JRException e)
    {
      if (log.isDebugEnabled())
      {
        log.debug("Print failed.", e);
      }

      throw new PrinterException(e.getMessage()); //NOPMD
    }

    return Printable.PAGE_EXISTS;
  }
View Full Code Here


   */
  public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
  {
    if (Thread.interrupted())
    {
      throw new PrinterException("Current thread interrupted.");
    }

    if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
    {
      return Printable.NO_SUCH_PAGE;
    }
   
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
    exporter.setParameter(JRExporterParameter.PAGE_INDEX, Integer.valueOf(pageIndex));
   
    try
    {
      exporter.exportReport();
    }
    catch (JRException e)
    {
      throw new PrinterException(e.getMessage()); //NOPMD
    }

    return Printable.PAGE_EXISTS;
  }
View Full Code Here

       
        AccessPermission currentPermissions = this.getCurrentAccessPermission();
       
        if(!currentPermissions.canPrint())
        {
            throw new PrinterException( "You do not have permission to print this document." );   
        }
        PrinterJob printJob = PrinterJob.getPrinterJob();
        printJob.setPageable(this);
        if( printJob.printDialog() )
        {
View Full Code Here

       
        AccessPermission currentPermissions = this.getCurrentAccessPermission();
       
        if(!currentPermissions.canPrint())
        {
            throw new PrinterException( "You do not have permission to print this document." );
        }
        PrinterJob printJob = PrinterJob.getPrinterJob();
        printJob.setPageable(this);
        printJob.print();
    }
View Full Code Here

     */
    public void print(PrinterJob printJob) throws PrinterException
    {
        if(printJob == null)
        {
            throw new PrinterException( "The delivered printJob is null." );
        }
        AccessPermission currentPermissions = this.getCurrentAccessPermission();

        if(!currentPermissions.canPrint())
        {
            throw new PrinterException( "You do not have permission to print this document." );
        }
        printJob.setPageable(this);
        if( printJob.printDialog() )
        {
            printJob.print();
View Full Code Here

     */
    public void silentPrint( PrinterJob printJob ) throws PrinterException
    {
        if(printJob == null)
        {
            throw new PrinterException( "The delivered printJob is null." );
        }
        AccessPermission currentPermissions = this.getCurrentAccessPermission();

        if(!currentPermissions.canPrint())
        {
            throw new PrinterException( "You do not have permission to print this document." );
        }
        printJob.setPageable(this);
        printJob.print();
    }
View Full Code Here

        {
            throw new IllegalArgumentException("printerJob");
        }
        else if (!document.getCurrentAccessPermission().canPrint())
        {
            throw new PrinterException("You do not have permission to print this document");
        }
        this.document = document;
        this.renderer = new PDFRenderer(document);
        this.printerJob = printerJob;
        this.scaling = scaling;
View Full Code Here

    private void print(PrinterJob job, boolean silent) throws PrinterException
    {
        if (job == null)
        {
            throw new PrinterException("The given printer job is null.");
        }
        else
        {
            job.setPageable(new PDPageable(this, job));
            if (silent || job.printDialog())
View Full Code Here

            throw new IllegalArgumentException(
                    "PDPageable(" + document + ", " + printerJob + ")");
        }
        else if (!document.getCurrentAccessPermission().canPrint())
        {
            throw new PrinterException(
                "You do not have permission to print this document");
        }
        else
        {
            document.getDocumentCatalog().getPages().getAllKids(pages);
View Full Code Here

        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);
      throw new PrinterException("Error occured when processing the SVG data :" + e.getMessage());   
    }
  }
View Full Code Here

TOP

Related Classes of java.awt.print.PrinterException

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.