Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfTemplate


        if ((pg.getStatus() & java.awt.image.ImageObserver.ABORT) != 0) {
            throw new IOException(MessageLocalization.getComposedMessage("java.awt.image.fetch.aborted.or.errored"));
        }
        int w = pg.getWidth();
        int h = pg.getHeight();
        PdfTemplate tp = cb.createTemplate(w, h);
        PdfGraphics2D g2d = new PdfGraphics2D(tp, w, h, null, false, true, quality);
        g2d.drawImage(awtImage, 0, 0, null);
        g2d.dispose();
        return getInstance(tp);
    }
View Full Code Here


    }

    public final void refresh(PdfPTable table) throws BadElementException {
        float templateWidth = doc.getPageSize().getWidth();
        float templateHight = doc.getPageSize().getHeight();
        PdfTemplate tp = PdfTemplate.createTemplate(writer, templateWidth, templateHight);
        float leftMargin = (doc.isMarginMirroring() && oddOrEven == EVEN) ? doc.rightMargin() : doc.leftMargin();
        table.writeSelectedRows(0, -1, leftMargin, templateHight, tp);
        Image footer = Image.getInstance(tp);
        footer.setAbsolutePosition(0, 0);
        this.image = footer;
View Full Code Here

        if ((pg.getStatus() & java.awt.image.ImageObserver.ABORT) != 0) {
            throw new IOException(MessageLocalization.getComposedMessage("java.awt.image.fetch.aborted.or.errored"));
        }
        int w = pg.getWidth();
        int h = pg.getHeight();
        PdfTemplate tp = cb.createTemplate(w, h);
        Graphics2D g2d = tp.createGraphics(w, h, true, quality);
        g2d.drawImage(awtImage, 0, 0, null);
        g2d.dispose();
        return getInstance(tp);
    }
View Full Code Here

        if ((pg.getStatus() & java.awt.image.ImageObserver.ABORT) != 0) {
            throw new IOException(MessageLocalization.getComposedMessage("java.awt.image.fetch.aborted.or.errored"));
        }
        int w = pg.getWidth();
        int h = pg.getHeight();
        PdfTemplate tp = cb.createTemplate(w, h);
        Graphics2D g2d = tp.createGraphics(w, h, true, quality);
        g2d.drawImage(awtImage, 0, 0, null);
        g2d.dispose();
        return getInstance(tp);
    }
View Full Code Here

        if ((pg.getStatus() & java.awt.image.ImageObserver.ABORT) != 0) {
            throw new IOException(MessageLocalization.getComposedMessage("java.awt.image.fetch.aborted.or.errored"));
        }
        int w = pg.getWidth();
        int h = pg.getHeight();
        PdfTemplate tp = cb.createTemplate(w, h);
        Graphics2D g2d = tp.createGraphics(w, h, true, quality);
        g2d.drawImage(awtImage, 0, 0, null);
        g2d.dispose();
        return getInstance(tp);
    }
View Full Code Here

        public void onEndPage(PdfWriter writer, Document document)
        {
            /** The headertable. */
            PdfPTable table = new PdfPTable(2);
            /** A template that will hold the total number of pages. */
            PdfTemplate tpl = writer.getDirectContent().createTemplate(100, 100);
            /** The font that will be used. */
            BaseFont helv = null;
            try
            {
                helv = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false);
View Full Code Here

        if ((pg.getStatus() & java.awt.image.ImageObserver.ABORT) != 0) {
            throw new IOException(MessageLocalization.getComposedMessage("java.awt.image.fetch.aborted.or.errored"));
        }
        int w = pg.getWidth();
        int h = pg.getHeight();
        PdfTemplate tp = cb.createTemplate(w, h);
        PdfGraphics2D g2d = new PdfGraphics2D(tp, w, h, null, false, true, quality);
        g2d.drawImage(awtImage, 0, 0, null);
        g2d.dispose();
        return getInstance(tp);
    }
View Full Code Here

      PdfWriter writer;
      writer = PdfWriter.getInstance(document, new FileOutputStream(
          filepath));
      document.open();
      PdfContentByte cb = writer.getDirectContent();
      PdfTemplate tp = cb.createTemplate(graphContainer.getWidth(),
          graphContainer.getHeight());
      Graphics2D g2d = tp.createGraphics(graphContainer.getWidth(),
          graphContainer.getHeight(), new DefaultFontMapper());

      graphContainer.addNotify();
      graphContainer.validate();
View Full Code Here

  }

  public static void addChartToPDF(JFreeChart chart, Rectangle rect,
      PdfWriter writer) {
    PdfContentByte cb = writer.getDirectContent();
    PdfTemplate tp = cb.createTemplate(rect.getWidth(), rect.getHeight());
    Graphics2D g2 = tp.createGraphics(rect.getWidth(), rect.getHeight(), new DefaultFontMapper());
    Rectangle2D r2D = new Rectangle2D.Double(0, 0, rect.getWidth(), rect.getHeight());
    chart.draw(g2, r2D, null);
    g2.dispose();
    cb.addTemplate(tp, 0, 0);
  }
View Full Code Here

  public static void addChartToPDF2(JFreeChart chart,
      PdfWriter writer, int row, int column) {
    Rectangle rect = PageSize.A6.rotate();
    Rectangle rect2 = PageSize.A4.rotate();
    PdfContentByte cb = writer.getDirectContent();
    PdfTemplate tp = cb.createTemplate(rect.getWidth(), rect.getHeight());
    Graphics2D g2 = tp.createGraphics(rect.getWidth(), rect.getHeight(), new DefaultFontMapper());
    Rectangle2D r2D = new Rectangle2D.Double(0, 0, rect2.getWidth(), rect2.getHeight());
    g2.setTransform(AffineTransform.getScaleInstance(rect.getWidth()/rect2.getWidth(), rect.getHeight()/rect2.getHeight()));
    chart.draw(g2, r2D, null);
    g2.dispose();
    cb.addTemplate(tp, column * rect.getWidth(), row * rect.getHeight());
 
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.PdfTemplate

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.