Package com.lowagie.text

Examples of com.lowagie.text.Rectangle


      int widthBorder, int heightBorder, boolean landscape, int dpi) {
    Dimension printPageSize = null;
    printPageSize = new Dimension(paper.getPixelWidth(landscape, dpi), paper.getPixelHeight(landscape, dpi));

    // step 1: creation of a document-object
    Document document = new Document(new Rectangle(printPageSize.width,
        printPageSize.height));

    try {

      // step 2:
View Full Code Here


* @author Andrea Antonello (www.hydrologis.com)
*/
public class A1PortraitTemplate extends AbstractPrinterPageTemplate {

    protected Rectangle getPaperSize() {
        Rectangle a1 = PageSize.A1;
        return a1;
    }
View Full Code Here

* @author Andrea Antonello (www.hydrologis.com)
*/
public class LegalLandscapeTemplate extends AbstractPrinterPageTemplate {

    protected Rectangle getPaperSize() {
        Rectangle legal = PageSize.LEGAL;
        Rectangle legalLandscape = new Rectangle(0f, 0f, legal.getHeight(), legal.getWidth());
        return legalLandscape;
    }
View Full Code Here

* @author Andrea Antonello (www.hydrologis.com)
*/
public class LetterPortraitTemplate extends AbstractPrinterPageTemplate {

    protected Rectangle getPaperSize() {
        Rectangle legal = PageSize.LEGAL;
        return legal;
    }
View Full Code Here

* @author Andrea Antonello (www.hydrologis.com)
*/
public class A2PortraitTemplate extends AbstractPrinterPageTemplate {

    protected Rectangle getPaperSize() {
        Rectangle a2 = PageSize.A2;
        return a2;
    }
View Full Code Here

* @author Andrea Antonello (www.hydrologis.com)
*/
public class LetterLandscapeTemplate extends AbstractPrinterPageTemplate {

    protected Rectangle getPaperSize() {
        Rectangle letter = PageSize.LETTER;
        Rectangle letterLandscape = new Rectangle(0f, 0f, letter.getHeight(), letter.getWidth());
        return letterLandscape;
    }
View Full Code Here

* @author Andrea Antonello (www.hydrologis.com)
*/
public class A4LandscapeTemplate extends AbstractPrinterPageTemplate {

    protected Rectangle getPaperSize() {
        Rectangle a4 = PageSize.A4;
        Rectangle a4Landscape = new Rectangle(0f, 0f, a4.getHeight(), a4.getWidth());
        return a4Landscape;
    }
View Full Code Here

   
    @Override
    public boolean performFinish() {
       
        //create the document                
        Rectangle suggestedPageSize = getITextPageSize(page1.getPageSize());               
        Rectangle pageSize = rotatePageIfNecessary(suggestedPageSize); //rotate if we need landscape
       
        Document document = new Document(pageSize)
       
       
        try {
           
            //Basic setup of the Document, and get instance of the iText Graphics2D
            //   to pass along to uDig's standard "printing" code.
            String outputFile = page1.getDestinationDir()+
                System.getProperty("file.separator")+ //$NON-NLS-1$
                page1.getOutputFile();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outputFile));
            document.open();           
            Graphics2D graphics = null;
            Template template = getTemplate();
           
            int i = 0;
            int numPages = 1;
            do {
               
                //sets the active page
                template.setActivePage(i);
               
                PdfContentByte cb = writer.getDirectContent();    
               
                Page page = makePage(pageSize, document, template);
               
                graphics = cb.createGraphics(pageSize.getWidth(), pageSize.getHeight());
                        
                //instantiate a PrinterEngine (pass in the Page instance)
                PrintingEngine engine = new PrintingEngine(page);
               
                //make page format
                PageFormat pageFormat = new PageFormat();
                pageFormat.setOrientation(PageFormat.PORTRAIT);
                java.awt.print.Paper awtPaper = new java.awt.print.Paper();
                awtPaper.setSize(pageSize.getWidth() * 3, pageSize.getHeight() *3);
                awtPaper.setImageableArea(0, 0, pageSize.getWidth(), pageSize.getHeight());
                pageFormat.setPaper(awtPaper);
               
                //run PrinterEngine's print function
                engine.print(graphics, pageFormat, 0);
                 
View Full Code Here

        //rotate the page if dimensions are given as portrait, but template prefers landscape
        if (suggestedPageSize.getHeight() > suggestedPageSize.getWidth() && page1.isLandscape()) {
            float temp = suggestedPageSize.getWidth();
            float newWidth = suggestedPageSize.getHeight();
            float newHeight = temp;
            return new Rectangle(suggestedPageSize.getHeight(), suggestedPageSize.getWidth());
        }
        return suggestedPageSize;
    }
View Full Code Here

* @author Andrea Antonello (www.hydrologis.com)
*/
public class A0PortraitTemplate extends AbstractPrinterPageTemplate {

    protected Rectangle getPaperSize() {
        Rectangle a0 = PageSize.A0;
        return a0;
    }
View Full Code Here

TOP

Related Classes of com.lowagie.text.Rectangle

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.