Examples of scaleToFit()


Examples of com.lowagie.text.Image.scaleToFit()

                    try {
                        Image img = TiffImage.getTiffImage(ra, c + 1);
                        if (img != null) {
                            System.out.println("page " + (c + 1));
                            if (img.getScaledWidth() > 500 || img.getScaledHeight() > 700) {
                                img.scaleToFit(500, 700);
                            }
                            img.setAbsolutePosition(20, 20);
                            document.add(new Paragraph(tiff_file + " - page " + (c + 1)));
                            cb.addImage(img);
                            document.newPage();
View Full Code Here

Examples of com.lowagie.text.Image.scaleToFit()

        checkIfDocIsClosed();

        try {
            Image pdfImage = Image.getInstance(image, null);
            pdfImage.setAbsolutePosition(0, 0);
            pdfImage.scaleToFit(width, height);
            PdfTemplate template = this.contentByte.createTemplate(image.getWidth(), image.getHeight());
            template.addImage(pdfImage);
            final float leftMargin = this.document.leftMargin();
            this.contentByte.addTemplate(template, leftMargin + x, y);
        } catch (BadElementException e) {
View Full Code Here

Examples of com.lowagie.text.Image.scaleToFit()

        checkIfDocIsClosed();

        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) {
View Full Code Here

Examples of com.lowagie.text.LwgImage.scaleToFit()

                                float adjy = height / img.getScaledHeight();
                                float adj = Math.min(adjx, adjy);
                                img.scalePercent(7200f / img.getDpiX() * adj, 7200f / img.getDpiY() * adj);
                            }
                            else
                                img.scaleToFit(width, height);
                    }
                    img.setAbsolutePosition(20, 20);
                        document.newPage();
                        document.add(new Paragraph(tiff_file + " - page " + (c + 1)));
                  }
View Full Code Here

Examples of com.lowagie.text.LwgImage.scaleToFit()

            cb.moveTo(410, 525);
            cb.lineTo(410, 0);
            cb.stroke();
            if (getValue("front") != null) {
              LwgImage front = (LwgImage)getValue("front");
              front.scaleToFit(370, 525);
              front.setAbsolutePosition(410f + (370f - front.getScaledWidth()) / 2f, (525f - front.getScaledHeight()) / 2f);
              document.add(front);
            }
            if (getValue("back") != null) {
              LwgImage back = (LwgImage)getValue("back");
View Full Code Here

Examples of com.lowagie.text.LwgImage.scaleToFit()

              front.setAbsolutePosition(410f + (370f - front.getScaledWidth()) / 2f, (525f - front.getScaledHeight()) / 2f);
              document.add(front);
            }
            if (getValue("back") != null) {
              LwgImage back = (LwgImage)getValue("back");
              back.scaleToFit(370, 525);
              back.setAbsolutePosition((370f - back.getScaledWidth()) / 2f, (525f - back.getScaledHeight()) / 2f);
              document.add(back);
            }
            if (getValue("side") != null) {
              LwgImage side = (LwgImage)getValue("side");
View Full Code Here

Examples of com.lowagie.text.LwgImage.scaleToFit()

              back.setAbsolutePosition((370f - back.getScaledWidth()) / 2f, (525f - back.getScaledHeight()) / 2f);
              document.add(back);
            }
            if (getValue("side") != null) {
              LwgImage side = (LwgImage)getValue("side");
              side.scaleToFit(40, 525);
              side.setAbsolutePosition(370 + (40f - side.getScaledWidth()) / 2f, (525f - side.getScaledHeight()) / 2f);
              document.add(side);
            }

            // step 5: we close the document
View Full Code Here

Examples of com.lowagie.text.LwgImage.scaleToFit()

                ColumnText ct2 = new ColumnText(t);
                ct2.setRunDirection(runDirection);
                ct2.setSimpleColumn(signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), 0, LwgElement.ALIGN_RIGHT);

                LwgImage im = LwgImage.getInstance(signatureGraphic);
                im.scaleToFit(signatureRect.getWidth(), signatureRect.getHeight());

                Paragraph p = new Paragraph();
                // must calculate the point to draw from to make image appear in middle of column
                float x = 0;
                // experimentation found this magic number to counteract Adobe's signature graphic, which
View Full Code Here

Examples of com.lowagie.text.LwgImage.scaleToFit()

                    try {
                        LwgImage img = TiffImage.getTiffImage(ra, c + 1);
                        if (img != null) {
                            System.out.println("page " + (c + 1));
                            if (img.getScaledWidth() > 500 || img.getScaledHeight() > 700) {
                                img.scaleToFit(500, 700);
                            }
                            img.setAbsolutePosition(20, 20);
                            document.add(new Paragraph(tiff_file + " - page " + (c + 1)));
                            cb.addImage(img);
                            document.newPage();
View Full Code Here

Examples of com.lowagie.text.LwgImage.scaleToFit()

     */

    private float addImage(LwgImage i, float left, float right, float extraHeight, int alignment) {
        LwgImage image = LwgImage.getInstance(i);
        if (image.getScaledWidth() > right - left) {
            image.scaleToFit(right - left, Float.MAX_VALUE);
        }
        flushCurrentLine();
        if (line == null) {
            line = new PdfLine(left, right, alignment, leading);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.