Example usage for com.lowagie.text Rectangle setBottom

List of usage examples for com.lowagie.text Rectangle setBottom

Introduction

In this page you can find the example usage for com.lowagie.text Rectangle setBottom.

Prototype

public void setBottom(float lly) 

Source Link

Document

Sets the lower left y-coordinate.

Usage

From source file:com.estate.pdf.Page.java

protected Rectangle adjustPlacement(Rectangle rctIn) {
    Rectangle rctOut = new Rectangle(rctIn);

    rctOut.setLeft(rctOut.getLeft() - _1_4TH);
    rctOut.setBottom(rctOut.getBottom() - _1_4TH);
    return rctOut;
}

From source file:com.estate.pdf.Page.java

protected Rectangle toPage(float orgX, float orgY, Rectangle orgRect) {
    Rectangle rct = new Rectangle(orgRect);

    rct.setLeft(rct.getLeft() + orgX);/*from   w  w w  . j  av  a 2  s.  c o m*/
    rct.setRight(rct.getRight() + orgX);
    rct.setTop(rct.getTop() + orgY);
    rct.setBottom(rct.getBottom() + orgY);

    return rct;
}

From source file:com.estate.pdf.PageBorder.java

public void draw(Document doc, int iconNum, String pageNum, String toolName) {
    try {//from  w w  w. ja  v a  2  s. c  om
        PdfContentByte cb = writer.getDirectContentUnder();
        BaseFont fontBold = BaseFont.createFont(Locations.getFontLocation() + "timesbd.ttf", BaseFont.CP1252,
                BaseFont.EMBEDDED);
        BaseFont font = BaseFont.createFont(Locations.getFontLocation() + "times.ttf", BaseFont.CP1252,
                BaseFont.EMBEDDED);
        Rectangle rct = new Rectangle(doc.getPageSize());
        float iconBase = (1.25f * 72); // This is the base of the icons on
        // the page
        Image icon = Image.getInstance(Locations.getImageLocation() + icons[iconNum]);
        // Image box = Image.getInstance(Locations.ImageLocation() +
        // "blueBOX.png");
        icon.scalePercent(23);
        float scale = .23f;
        float iconLeft = (icon.getWidth() / 2) * scale;
        float boxSize = (.1875f * 72);

        // Adjust the top
        rct.setTop(rct.getTop() - (.5f * 72));

        // Place the Icon
        icon.setAbsolutePosition((1.25f * 72) - iconLeft, rct.getTop() - iconBase);
        doc.add(icon);

        // Set our line color
        cb.setRGBColorStroke(0, 72, 117);

        cb.setLineWidth(.75f);

        // do the bottom line
        cb.moveTo(1.25f * 72, (.5f * 72));
        cb.lineTo(rct.getRight() - (.5f * 72), (.5f * 72));

        cb.moveTo(1.25f * 72, (.5f * 72));
        cb.lineTo(1.25f * 72, rct.getTop());

        // stroke the lines
        cb.stroke();

        // Do the lower left box
        cb.rectangle((1.25f - 0.09375f) * 72, (.5f - 0.09375f) * 72, boxSize, boxSize);
        cb.setRGBColorFill(0, 72, 117);
        cb.closePathFillStroke();

        // Do the lower right box
        Rectangle pnRect = new Rectangle(0, 0);
        pnRect.setLeft(rct.getRight() - ((.5f + 0.09375f) * 72));
        pnRect.setTop((.5f - 0.09375f) * 72);
        pnRect.setRight(pnRect.getLeft() + boxSize);
        pnRect.setBottom(pnRect.getTop() - boxSize);

        // cb.rectangle(rct.getRight() - ((.5f + 0.09375f) * 72), (.5f -
        // 0.09375f) * 72, (.1875f * 72), (.1875f * 72));
        cb.rectangle(pnRect.getLeft(), pnRect.getTop(), boxSize, boxSize);
        cb.setRGBColorFill(0, 72, 117);
        cb.closePathFillStroke();

        // Now we do the page number if one is supplied.
        if (pageNum.length() > 0) {
            float pnHeight = fontBold.getAscentPoint(pageNum, 9) - fontBold.getDescentPoint(pageNum, 9);
            float pnWidth = fontBold.getWidthPoint(pageNum, 9);

            float l = pnRect.getLeft() + ((boxSize - pnWidth) / 2);
            float b = pnRect.getTop() + ((boxSize - pnHeight) / 2);

            cb.beginText();
            cb.setFontAndSize(fontBold, 9);
            cb.setRGBColorFill(255, 255, 255);
            cb.setTextMatrix(l, b);
            cb.showText(pageNum);
            cb.endText();

        }

        // Display the copyright
        SimpleDateFormat df = new SimpleDateFormat("yyyy");
        char cs = 0x00a9; // Unicode for the copyright symbol
        String copyRight = com.estate.constants.StringConstants.copyRight + cs + " " + df.format(new Date());
        float crWidth;
        float crLeft;

        crWidth = font.getWidthPoint(copyRight, 8);
        cb.beginText();

        cb.setFontAndSize(font, 8);
        cb.setRGBColorFill(0, 0, 0);

        crLeft = (doc.getPageSize().getRight() - crWidth) / 2;
        cb.setTextMatrix(crLeft, .375f * 72); // Place the base of the
        // copyright at 3/8" up from
        // the bottom
        cb.showText(copyRight);
        cb.endText();

        if (toolName.length() > 0) {
            cb.beginText();

            cb.setFontAndSize(font, 8);
            cb.setRGBColorFill(0, 0, 0);

            cb.setTextMatrix((1.25f * 72) + boxSize, .375f * 72);
            cb.showText(toolName);
            cb.endText();
        }

        // Fix a licensee at left
        cb.beginText();
        cb.setFontAndSize(font, 8);
        cb.setRGBColorFill(0, 0, 0);
        cb.showTextAligned(PdfContentByte.ALIGN_RIGHT, " Licensee: " + getLicense(), (10.2f * 72), .375f * 72,
                0);
        cb.endText();
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}

From source file:com.estate.pdf.PageBorder.java

public void drawNoBorder(Document doc, String pageNum) {
    try {/*from  ww  w .j  av  a  2 s.  c  o  m*/
        PdfContentByte cb = writer.getDirectContentUnder();
        BaseFont fontBold = BaseFont.createFont(Locations.getFontLocation() + "timesbd.ttf", BaseFont.CP1252,
                BaseFont.EMBEDDED);
        BaseFont font = BaseFont.createFont(Locations.getFontLocation() + "times.ttf", BaseFont.CP1252,
                BaseFont.EMBEDDED);
        Rectangle rct = new Rectangle(doc.getPageSize());
        float boxSize = (.1875f * 72);

        // Adjust the top
        rct.setTop(rct.getTop() - (.5f * 72));

        // Do the lower right box
        Rectangle pnRect = new Rectangle(0, 0);
        pnRect.setLeft(rct.getRight() - ((.5f + 0.09375f) * 72));
        pnRect.setTop(((.5f - 0.09375f) * 72) - 9);
        pnRect.setRight(pnRect.getLeft() + boxSize);
        pnRect.setBottom(pnRect.getTop() - boxSize);

        cb.rectangle(pnRect.getLeft(), pnRect.getTop(), boxSize, boxSize);
        cb.setRGBColorFill(0, 72, 117);
        cb.closePathFillStroke();

        // Now we do the page number if one is supplied.
        if (pageNum.length() > 0) {
            float pnHeight = fontBold.getAscentPoint(pageNum, 9) - fontBold.getDescentPoint(pageNum, 9) - 4.5f;
            float pnWidth = fontBold.getWidthPoint(pageNum, 9);

            float l = pnRect.getLeft() + ((boxSize - pnWidth) / 2);
            float b = pnRect.getTop() + ((boxSize - pnHeight) / 2) - 4.5f;

            cb.beginText();
            cb.setFontAndSize(fontBold, 9);
            cb.setRGBColorFill(255, 255, 255);
            cb.setTextMatrix(l, b);
            cb.showText(pageNum);
            cb.endText();
        }

        // Display the copyright
        SimpleDateFormat df = new SimpleDateFormat("yyyy");
        char cs = 0x00a9; // Unicode for the copyright symbol
        String copyRight = "Advanced Practice Network " + cs + " " + df.format(new Date());
        float crWidth;
        float crLeft;

        crWidth = font.getWidthPoint(copyRight, 8);
        cb.beginText();

        cb.setFontAndSize(font, 8);
        cb.setRGBColorFill(0, 0, 0);

        crLeft = (doc.getPageSize().getRight() - crWidth) / 2;
        cb.setTextMatrix(crLeft, .375f * 72); // Place the base of the
        // copyright at 3/8" up from
        // the bottom
        cb.showText(copyRight);
        cb.endText();

        if (license != null) {
            // Fix a licensee at left
            cb.beginText();
            cb.setFontAndSize(font, 8);
            cb.setRGBColorFill(0, 0, 0);
            cb.showTextAligned(PdfContentByte.ALIGN_RIGHT, " Licensee: " + getLicense(), (10.2f * 72),
                    .375f * 72, 0);
            cb.endText();
        }

    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}

From source file:com.estate.report.Scenario.java

public Rectangle placeHeading() {
    Rectangle rect = new Rectangle(document.getPageSize());
    BaseFont font = PageUtils.LoadFont("GARA.TTF");
    rect.setBottom(rect.getTop() - (72 * .6f));
    HeadingText ht = new HeadingText(this.writer);
    rect.setBottom(rect.getBottom() - (72 * .33f));
    ht.setColor(57, 57, 57);//from ww w  . java  2  s .  co m
    ht.setCapsColor(98, 98, 98);
    if (sc1)
        ht.display(rect, 12f, font, 3f, heading, HeadingText.DHT_CENTER);
    else
        ht.display(rect, 12f, font, 3f, heading2, HeadingText.DHT_CENTER);

    rect.setTop(rect.getBottom() - _1_8TH);
    rect.setBottom(prctFull.getBottom());
    rect.setLeft(_1_2TH);
    rect.setRight(rect.getLeft() + (11.f * 72));
    PageBorder pb = new PageBorder(writer);
    pb.setLicense(userInfo.getPlannerFirstName() + " " + userInfo.getPlannerLastName());
    pb.drawNoBorder(document, Integer.toString(pageNum));

    try {
        Rectangle rct = new Rectangle(document.getPageSize());
        float iconBase = (.75f * 72); // This is the base of the icons on
        // the page
        Image icon = Image.getInstance(Locations.getImageLocation() + "pawn.png");
        //    Image box = Image.getInstance(Locations.ImageLocation() +
        //    "blueBOX.png");
        icon.scalePercent(23);
        float scale = .23f;
        float iconLeft = (icon.getWidth() / 2) * scale;

        // Adjust the top
        rct.setTop(rct.getTop());

        // Place the Icon
        icon.setAbsolutePosition((.5f * 72) - iconLeft, rct.getTop() - iconBase);
        document.add(icon);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }

    drawLifeExp();

    return rect;
}

From source file:com.teag.reports.CashFlows.java

private Rectangle placeHeading() {

    String header = "Estimate Of Net Worth & Estate Distribution - Scenario #1 As Is (in 000's)";
    BaseFont font = PageUtils.LoadFont("GARA.TTF");

    Rectangle rect = new Rectangle(document.getPageSize());
    rect.setBottom(rect.getTop() - (72 * .6f));
    HeadingText ht = new HeadingText(this.writer);
    rect.setBottom(rect.getBottom() - (72 * .33f));
    ht.setColor(57, 57, 57);//w  w w.j av  a 2 s .co m
    ht.setCapsColor(98, 98, 98);
    ht.display(rect, 12f, font, 3f, header, HeadingText.DHT_CENTER);
    rect.setTop(rect.getBottom() - _1_8TH);
    rect.setBottom(prctFull.getBottom());
    rect.setLeft(_1_2TH);
    rect.setRight(rect.getLeft() + 11.f * 72);
    PageBorder pb = new PageBorder(writer);
    pb.setLicense(userInfo.getPlannerFirstName() + " " + userInfo.getPlannerLastName());
    pb.drawNoBorder(document, Integer.toString(pageNum));
    drawLifeExp();
    return (rect);
}

From source file:com.teag.reports.EstatePlan.java

private Rectangle placeHeading(String header) {

    BaseFont font = PageUtils.LoadFont("GARA.TTF");

    Rectangle rect = new Rectangle(document.getPageSize());
    rect.setBottom(rect.getTop() - (72 * .6f));
    HeadingText ht = new HeadingText(this.writer);
    rect.setBottom(rect.getBottom() - (72 * .33f));
    ht.setColor(57, 57, 57);/*from   w  ww . ja va  2 s. c o m*/
    ht.setCapsColor(98, 98, 98);
    ht.display(rect, 12f, font, 3f, header, HeadingText.DHT_CENTER);
    rect.setTop(rect.getBottom() - _1_8TH);
    rect.setBottom(prctFull.getBottom());
    rect.setLeft(_1_2TH);
    rect.setRight(rect.getLeft() + 11.0f * 72);
    drawHeader(client, "");
    PageBorder pb = new PageBorder(writer);
    pb.setLicense(userInfo.getPlannerFirstName() + " " + userInfo.getPlannerLastName());
    pb.drawNoBorder(document, Integer.toString(pageNum));
    drawLifeExp();

    return (rect);
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Move this rectangle to the specified bottom-left point.
 *
 * @param rect rectangle to move/*from   ww w  . java2  s  . c o  m*/
 * @param x new x origin
 * @param y new y origin
 */
public void moveRectangleTo(Rectangle rect, float x, float y) {
    float width = rect.getWidth();
    float height = rect.getHeight();
    rect.setLeft(x);
    rect.setBottom(y);
    rect.setRight(rect.getLeft() + width);
    rect.setTop(rect.getBottom() + height);
}

From source file:org.geomajas.plugin.print.component.PdfContext.java

License:Open Source License

/**
 * Translate this rectangle over the specified following distances.
 *
 * @param rect rectangle to move/*from ww w .  j a  v  a  2 s.  c o m*/
 * @param dx delta x
 * @param dy delta y
 */
public void translateRectangle(Rectangle rect, float dx, float dy) {
    float width = rect.getWidth();
    float height = rect.getHeight();
    rect.setLeft(rect.getLeft() + dx);
    rect.setBottom(rect.getBottom() + dy);
    rect.setRight(rect.getLeft() + dx + width);
    rect.setTop(rect.getBottom() + dy + height);
}