Package com.projity.print

Examples of com.projity.print.ViewPrintable


        Document document = new Document();
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
        pageable.update();
        int pageCount = pageable.getNumberOfPages();
        if (pageCount>0){
          ViewPrintable printable=pageable.getSafePrintable();
          ExtendedPageFormat pageFormat=pageable.getSafePageFormat();
          double width=pageFormat.getWidth();
          double height=pageFormat.getHeight();
          float startIncrement=0.1f;
          float endIncrement=0.0f;           
          float progressIncrement = (1.0f-startIncrement-endIncrement)/pageCount;
          for (int p=0;p< pageCount;p++) {
            setProgress(startIncrement+p*progressIncrement);
            document.setPageSize(new Rectangle((float)width,(float)height));
            if (p==0) document.open();
            else document.newPage();
           
            Graphics2D g = writer.getDirectContent().createGraphics((float)width, (float)height);
            printable.print(g, p);
            g.dispose();
          }
          document.close();
        }
        setProgress(1.0f);
View Full Code Here

TOP

Related Classes of com.projity.print.ViewPrintable

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.