Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfTemplate


    try {
      Image pdfImage = Image.getInstance(image, null);
      pdfImage.setAbsolutePosition(0, 0);
      pdfImage.scaleToFit(width, height);
      PdfTemplate template = contentByte.createTemplate(image.getWidth(), image.getHeight());
      template.addImage(pdfImage);
      final float leftMargin = document.leftMargin();
      contentByte.addTemplate(template, leftMargin + x, y);
    } catch (BadElementException e) {
      throw new GeracaoBoletoException(e);
    } catch (DocumentException e) {
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

             doc.open();

            PdfContentByte cb = writer.getDirectContent();

            // create a template
            PdfTemplate tp = cb.createTemplate(pw,ph);
            Graphics2D g2 = tp.createGraphicsShapes(pw,ph);

            // scale the template to fit the page
            AffineTransform at = new AffineTransform();
            float s = (float) Math.min(pw/w,ph/h);
            at.scale(s,s);
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.