Package com.lowagie.text

Examples of com.lowagie.text.LwgImage


            ctx.cellGraphics.rectangle(cell.rectangle(indentTop(), indentBottom()));
            // we write the text of the cell
            ArrayList images = cell.getImages(indentTop(), indentBottom());
            for (Iterator im = images.iterator(); im.hasNext();) {
              cellsShown = true;
              LwgImage image = (LwgImage) im.next();
              graphics.addImage(image);
            }
            lines = cell.getLines(indentTop(), indentBottom());
            float cellTop = cell.getTop(indentTop());
            text.moveText(0, cellTop-heightCorrection);
View Full Code Here


                }

                // and additional graphics
                ArrayList images = cell.getImages(ctx.pagetop, indentBottom());
                for (Iterator i = images.iterator(); i.hasNext();) {
                    LwgImage image = (LwgImage) i.next();
                    graphics.addImage(image);
                }

            }
        }
View Full Code Here

    * @since  3.0.0
    */
   public float getMaxHeight()
   {
      boolean isPivoted = (getRotation() == 90 || getRotation() == 270);
      LwgImage img = getImage();
     
      if (img != null)
      {
         img.scalePercent(100);
         float fltRefWidth = isPivoted ? img.getScaledHeight() : img.getScaledWidth();
        
         float scale = (getRight() - getEffectivePaddingRight()
               - getEffectivePaddingLeft() - getLeft()) / fltRefWidth;
        
         img.scalePercent(scale * 100);
         float fltRefHeight = isPivoted ? img.getScaledWidth() : img.getScaledHeight();
        
         setBottom(getTop() - getEffectivePaddingTop() - getEffectivePaddingBottom() - fltRefHeight);
      }
      else
      {
View Full Code Here

        continue;
      float currentMaxHeight = maxHeight + extraHeights[k];
     
      writeBorderAndBackground(xPos, yPos, currentMaxHeight, cell, canvases);

      LwgImage img = cell.getImage();
     
      float tly = cell.getTop() + yPos - cell.getEffectivePaddingTop();
      if (cell.getHeight() <= currentMaxHeight) {
        switch (cell.getVerticalAlignment()) {
        case LwgElement.ALIGN_BOTTOM:
          tly = cell.getTop() + yPos - currentMaxHeight + cell.getHeight()
              - cell.getEffectivePaddingTop();
          break;
        case LwgElement.ALIGN_MIDDLE:
          tly = cell.getTop() + yPos + (cell.getHeight() - currentMaxHeight) / 2
              - cell.getEffectivePaddingTop();
          break;
        default:
          break;
        }
      }
      if (img != null) {
                if (cell.getRotation() != 0) {
                    img = LwgImage.getInstance(img);
                    img.setRotation(img.getImageRotation() + (float)(cell.getRotation() * Math.PI / 180.0));
                }
        boolean vf = false;
        if (cell.getHeight() > currentMaxHeight) {
          img.scalePercent(100);
          float scale = (currentMaxHeight - cell.getEffectivePaddingTop() - cell
              .getEffectivePaddingBottom())
              / img.getScaledHeight();
          img.scalePercent(scale * 100);
          vf = true;
        }
        float left = cell.getLeft() + xPos
            + cell.getEffectivePaddingLeft();
        if (vf) {
          switch (cell.getHorizontalAlignment()) {
          case LwgElement.ALIGN_CENTER:
            left = xPos
                + (cell.getLeft() + cell.getEffectivePaddingLeft()
                    + cell.getRight()
                    - cell.getEffectivePaddingRight() - img
                    .getScaledWidth()) / 2;
            break;
          case LwgElement.ALIGN_RIGHT:
            left = xPos + cell.getRight()
                - cell.getEffectivePaddingRight()
                - img.getScaledWidth();
            break;
          default:
            break;
          }
          tly = cell.getTop() + yPos - cell.getEffectivePaddingTop();
        }
        img.setAbsolutePosition(left, tly - img.getScaledHeight());
        try {
          canvases[LwgPdfPTable.TEXTCANVAS].addImage(img);
        } catch (DocumentException e) {
          throw new ExceptionConverter(e);
        }
View Full Code Here

        }
        continue;
      }
      fixHs[k] = cell.getFixedHeight();
      minHs[k] = cell.getMinimumHeight();
      LwgImage img = cell.getImage();
      LwgPdfPCell newCell = new LwgPdfPCell(cell);
      if (img != null) {
        if (newHeight > cell.getEffectivePaddingBottom() + cell.getEffectivePaddingTop() + 2) {
          newCell.setPhrase(null);
          allEmpty = false;
View Full Code Here

               PdfName rname = new PdfName("img" + images.size());
               images.put(image.getMySerialId(), rname);
               imageDictionary.put(rname, dref);
               return rname;
            }
            LwgImage maskImage = image.getImageMask();
            PdfIndirectReference maskRef = null;
            if (maskImage != null)
            {
               PdfName mname = (PdfName) images.get(maskImage.getMySerialId());
               maskRef = getImageReference(mname);
            }
            PdfImage i = new PdfImage(image, "img" + images.size(), maskRef);
            if (image instanceof ImgJBIG2)
            {
View Full Code Here

            // and directs a PDF-stream to a file
            PdfWriter.getInstance(document, new FileOutputStream("imageChunks.pdf"));
            // step 3: we open the document
            document.open();
            // step 4: we create a table and add it to the document
            LwgImage img = LwgImage.getInstance("pngnow.png");
            img.scalePercent(70);
            Chunk ck = new Chunk(img, 0, -5);
            LwgPdfPTable table = new LwgPdfPTable(3);
            LwgPdfPCell cell = new LwgPdfPCell();
            cell.addElement(new Chunk(img, 5, -5));
            cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
View Full Code Here

                "of comparison only.";
            pdf417.setText(text);
            LwgDocument document = new LwgDocument(LwgPageSize.A4, 50, 50, 50, 50);
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("pdf417.pdf"));
            document.open();
            LwgImage img = pdf417.getImage();
            img.scalePercent(50, 50 * pdf417.getYHeight());
            document.add(img);
            document.close();
        }
        catch (Exception e) {
            e.printStackTrace();
View Full Code Here

           
            // step 3: we open the document
            document.open();
           
            // step 4: we add content
            LwgImage png = LwgImage.getInstance("hitchcock.png");
            png.setAbsolutePosition(171, 250);
            document.add(png);
            png.setAbsolutePosition(342, 500);
            document.add(png);
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
View Full Code Here

                    continue;
                }
                System.out.println("Processing: " + tiff_file);
                for (int c = 0; c < comps; ++c) {
                    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();
                            ++pages;
                        }
View Full Code Here

TOP

Related Classes of com.lowagie.text.LwgImage

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.