Package com.lowagie.text

Examples of com.lowagie.text.Rectangle


        PdfTemplate tpl = new PdfTemplate();
        tpl.writer = writer;
        tpl.pdf = pdf;
        tpl.thisReference = thisReference;
        tpl.pageResources = pageResources;
        tpl.bBox = new Rectangle(bBox);
        tpl.group = group;
        tpl.layer = layer;
        if (matrix != null) {
            tpl.matrix = new PdfArray(matrix);
        }
View Full Code Here


        urx = x;
        ury = y;
      }
     
      public PdfAnnotation createAnnotation(PdfWriter writer) {
        PdfAnnotation annotation = new PdfAnnotation(writer, new Rectangle(llx, lly, urx, ury));
        if (newPage != 0) {
              PdfIndirectReference ref = writer.getPageReference(newPage);
              destination.getArrayList().set(0, ref);
        }
        if (destination != null) annotation.put(PdfName.DEST, destination);
View Full Code Here

        }
       
        void applyRotation(PdfDictionary pageN, ByteBuffer out) {
            if (!cstp.rotateContents)
                return;
            Rectangle page = reader.getPageSizeWithRotation(pageN);
            int rotation = page.getRotation();
            switch (rotation) {
                case 90:
                    out.append(PdfContents.ROTATE90);
                    out.append(page.getTop());
                    out.append(' ').append('0').append(PdfContents.ROTATEFINAL);
                    break;
                case 180:
                    out.append(PdfContents.ROTATE180);
                    out.append(page.getRight());
                    out.append(' ');
                    out.append(page.getTop());
                    out.append(PdfContents.ROTATEFINAL);
                    break;
                case 270:
                    out.append(PdfContents.ROTATE270);
                    out.append('0').append(' ');
                    out.append(page.getRight());
                    out.append(PdfContents.ROTATEFINAL);
                    break;
            }
        }
View Full Code Here

                        annots.add(annot.getIndirectReference());
                        if (!annot.isUsed()) {
                            PdfRectangle rect = (PdfRectangle)annot.get(PdfName.RECT);
                            if (rect != null && (rect.left() != 0 || rect.right() != 0 || rect.top() != 0 || rect.bottom() != 0)) {
                                int rotation = reader.getPageRotation(pageN);
                                Rectangle pageSize = reader.getPageSizeWithRotation(pageN);
                                switch (rotation) {
                                    case 90:
                                        annot.put(PdfName.RECT, new PdfRectangle(
                                        pageSize.getTop() - rect.bottom(),
                                        rect.left(),
                                        pageSize.getTop() - rect.top(),
                                        rect.right()));
                                        break;
                                    case 180:
                                        annot.put(PdfName.RECT, new PdfRectangle(
                                        pageSize.getRight() - rect.left(),
                                        pageSize.getTop() - rect.bottom(),
                                        pageSize.getRight() - rect.right(),
                                        pageSize.getTop() - rect.top()));
                                        break;
                                    case 270:
                                        annot.put(PdfName.RECT, new PdfRectangle(
                                        rect.bottom(),
                                        pageSize.getRight() - rect.left(),
                                        rect.top(),
                                        pageSize.getRight() - rect.right()));
                                        break;
                                }
                            }
                        }
                    }
View Full Code Here

     * @param  bottom  the bottom position
     * @return  a <CODE>Rectangle</CODE>
     */

    public Rectangle rectangle(float top, float bottom) {
        Rectangle tmp = new Rectangle(getLeft(), getBottom(), getRight(), getTop());
        tmp.cloneNonPositionParameters(this);
        if (getTop() > top) {
            tmp.setTop(top);
            tmp.setBorder(border - (border & TOP));
        }
        if (getBottom() < bottom) {
            tmp.setBottom(bottom);
            tmp.setBorder(border - (border & BOTTOM));
        }
        return tmp;
    }
View Full Code Here

                urx = Math.max(urx, r[k]);
                ury = Math.max(ury, r[k + 1]);
            }
            annot = new Annotation(annot);
            annot.setDimensions(llx, lly, urx, ury);
            PdfAnnotation an = PdfAnnotationsImp.convertAnnotation(writer, annot, new Rectangle(llx, lly, urx, ury));
            if (an == null)
                return;
            addAnnotation(an);
        }
        catch (Exception ee) {
View Full Code Here

     * Gets the rotated page from a page dictionary.
     * @param page the page dictionary
     * @return the rotated page
     */
    public Rectangle getPageSizeWithRotation(PdfDictionary page) {
        Rectangle rect = getPageSize(page);
        int rotation = getPageRotation(page);
        while (rotation > 0) {
            rect = rect.rotate();
            rotation -= 90;
        }
        return rect;
    }
View Full Code Here

        ArrayList rect = box.getArrayList();
        float llx = ((PdfNumber)getPdfObjectRelease((PdfObject)rect.get(0))).floatValue();
        float lly = ((PdfNumber)getPdfObjectRelease((PdfObject)rect.get(1))).floatValue();
        float urx = ((PdfNumber)getPdfObjectRelease((PdfObject)rect.get(2))).floatValue();
        float ury = ((PdfNumber)getPdfObjectRelease((PdfObject)rect.get(3))).floatValue();
        return new Rectangle(Math.min(llx, urx), Math.min(lly, ury),
        Math.max(llx, urx), Math.max(lly, ury));
    }
View Full Code Here

      backgr.fill();
        }
    // if the element hasn't got any borders, nothing is added
    if (cell.hasBorders()) {
      if (cell.isUseVariableBorders()) {
        Rectangle borderRect = new Rectangle(cell.getLeft() + xPos, cell
            .getTop()
            - maxHeight + yPos, cell.getRight() + xPos, cell.getTop()
            + yPos);
        borderRect.cloneNonPositionParameters(cell);
                borderRect.setBackgroundColor(null);
        lines.rectangle(borderRect);
      } else {
        // the width is set to the width of the element
        if (cell.getBorderWidth() != Rectangle.UNDEFINED) {
          lines.setLineWidth(cell.getBorderWidth());
View Full Code Here

                    }
                }
            }
      PdfPCellEvent evt = cell.getCellEvent();
      if (evt != null) {
        Rectangle rect = new Rectangle(cell.getLeft() + xPos, cell.getTop()
            + yPos - maxHeight, cell.getRight() + xPos, cell.getTop()
            + yPos);
        evt.cellLayout(cell, rect, canvases);
      }
    }
View Full Code Here

TOP

Related Classes of com.lowagie.text.Rectangle

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.