Package com.lowagie.text

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


      PdfPCell cell = cells[k];
      if (cell == null)
        continue;
      Image img = cell.getImage();
      if (img != null) {
        img.scalePercent(100);
                float refWidth = img.getScaledWidth();
                if (cell.getRotation() == 90 || cell.getRotation() == 270) {
                    refWidth = img.getScaledHeight();
                }
                float scale = (cell.getRight() - cell.getEffectivePaddingRight()
View Full Code Here


                    refWidth = img.getScaledHeight();
                }
                float scale = (cell.getRight() - cell.getEffectivePaddingRight()
                    - cell.getEffectivePaddingLeft() - cell.getLeft())
                    / refWidth;
                img.scalePercent(scale * 100);
                float refHeight = img.getScaledHeight();
                if (cell.getRotation() == 90 || cell.getRotation() == 270) {
                    refHeight = img.getScaledWidth();
                }
                cell.setBottom(cell.getTop() - cell.getEffectivePaddingTop()
View Full Code Here

                    img = Image.getInstance(img);
                    img.setRotation(img.getImageRotation() + (float)(cell.getRotation() * Math.PI / 180.0));
                }
        boolean vf = false;
        if (cell.getHeight() > maxHeight) {
          img.scalePercent(100);
          float scale = (maxHeight - cell.getEffectivePaddingTop() - cell
              .getEffectivePaddingBottom())
              / img.getScaledHeight();
          img.scalePercent(scale * 100);
          vf = true;
View Full Code Here

        if (cell.getHeight() > maxHeight) {
          img.scalePercent(100);
          float scale = (maxHeight - cell.getEffectivePaddingTop() - cell
              .getEffectivePaddingBottom())
              / img.getScaledHeight();
          img.scalePercent(scale * 100);
          vf = true;
        }
        float left = cell.getLeft() + xPos
            + cell.getEffectivePaddingLeft();
        if (vf) {
View Full Code Here

     
      doc.open();
       PdfPTable headerTable= new PdfPTable(2);
          Image ii = Image.getInstance("c:/smi-logo.gif");
          ii.setAlignment(Element.ALIGN_RIGHT);
          ii.scalePercent(25);
      
          PdfPCell cell1 = new PdfPCell(ii,false);
          cell1.setBorder(0);
         
          headerTable.addCell(cell1);
View Full Code Here

            float width = PageSize.A4.width() - 40;
            float height = PageSize.A4.height() - 120;
      if ("ORIGINAL".equals(getValue("pagesize"))) {
        Image img = TiffImage.getTiffImage(ra, 1);
                if (img.getDpiX() > 0 && img.getDpiY() > 0) {
                    img.scalePercent(7200f / img.getDpiX(), 7200f / img.getDpiY());
                }
        document.setPageSize(new Rectangle(img.scaledWidth(), img.scaledHeight()));
        adjustSize = true;
      }
      else if ("LETTER".equals(getValue("pagesize"))) {
View Full Code Here

      PdfContentByte cb = writer.getDirectContent();
            for (int c = 0; c < comps; ++c) {
                Image img = TiffImage.getTiffImage(ra, c + 1);
                if (img != null) {
                    if (img.getDpiX() > 0 && img.getDpiY() > 0) {
                        img.scalePercent(7200f / img.getDpiX(), 7200f / img.getDpiY());
                    }
                  if (adjustSize) {
              document.setPageSize(new Rectangle(img.scaledWidth(),
                  img.scaledHeight()));
                        document.newPage();
View Full Code Here

                    if (img.scaledWidth() > width || img.scaledHeight() > height) {
                            if (img.getDpiX() > 0 && img.getDpiY() > 0) {
                                float adjx = width / img.scaledWidth();
                                float adjy = height / img.scaledHeight();
                                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);
View Full Code Here

          // this is percentage to resize
          // The image must be size within the cell         
          int percToResize=percentageToResize((int)img.getWidth(), (int)img.getHeight(), tableWidth, tableHeight);
          logger.debug("image will be scaled of percentage "+percToResize);
          img.scalePercent(percToResize);
         
          PdfPCell cell= new PdfPCell(img);
          cell.setNoWrap(true);
          cell.setFixedHeight(tableHeight);
          cell.setBorderWidth(0);
View Full Code Here

                    if (img.getScaledWidth() > width || img.getScaledHeight() > height) {
                            if (img.getDpiX() > 0 && img.getDpiY() > 0) {
                                float adjx = width / img.getScaledWidth();
                                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);
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.