Package com.lowagie.text

Examples of com.lowagie.text.LwgRectangle


    /** Gets the maximum area that the barcode and the text, if
     * any, will occupy. The lower left corner is always (0, 0).
     * @return the size the barcode occupies.
     */
    public LwgRectangle getBarcodeSize() {
        LwgRectangle rect = ean.getBarcodeSize();
        rect.setRight(rect.getWidth() + supp.getBarcodeSize().getWidth() + n);
        return rect;
    }
View Full Code Here


    public LwgRectangle placeBarcode(PdfContentByte cb, Color barColor, Color textColor) {
        if (supp.getFont() != null)
            supp.setBarHeight(ean.getBarHeight() + supp.getBaseline() - supp.getFont().getFontDescriptor(BaseFont.CAPHEIGHT, supp.getSize()));
        else
            supp.setBarHeight(ean.getBarHeight());
        LwgRectangle eanR = ean.getBarcodeSize();
        cb.saveState();
        ean.placeBarcode(cb, barColor, textColor);
        cb.restoreState();
        cb.saveState();
        cb.concatCTM(1, 0, 0, 1, eanR.getWidth() + n, eanR.getHeight() - ean.getBarHeight());
        supp.placeBarcode(cb, barColor, textColor);
        cb.restoreState();
        return getBarcodeSize();
    }
View Full Code Here

                break;
            case 270:
                app.setMatrix(0, -1, 1, 0, 0, box.getWidth());
                break;
        }
        LwgRectangle box = new LwgRectangle(app.getBoundingBox());
        float cx = box.getWidth() / 2;
        float cy = box.getHeight() / 2;
        float r = (Math.min(box.getWidth(), box.getHeight()) - borderWidth) / 2;
        if (r <= 0)
            return app;
        if (backgroundColor != null) {
            app.setColorFill(backgroundColor);
            app.circle(cx, cy, r + borderWidth / 2);
View Full Code Here

            cb.moveTo(0, 0);
            String text = "Some start text";
            float fontSize = 12;
            Color textColor = new GrayColor(0f);
            PdfFormField field = PdfFormField.createTextField(writer, false, false, 0);
            field.setWidget(new LwgRectangle(171, 750, 342, 769), PdfAnnotation.HIGHLIGHT_INVERT);
            field.setFlags(PdfAnnotation.FLAGS_PRINT);
            field.setFieldName("ATextField");
            field.setValueAsString(text);
            field.setDefaultValueAsString(text);
            field.setBorderStyle(new PdfBorderDictionary(2, PdfBorderDictionary.STYLE_SOLID));
View Full Code Here

            radio.setFieldName("CreditCard");
            radio.setValueAsName("MasterCard");

            PdfFormField radio1 = PdfFormField.createEmpty(writer);
            radio1.setWidget(new LwgRectangle(100, 700, 120, 720), PdfAnnotation.HIGHLIGHT_INVERT);
            radio1.setAppearanceState("MasterCard");
            radio1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
            radio1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "MasterCard", tpOn);
            radio.addKid(radio1);
           
            PdfFormField radio2 = PdfFormField.createEmpty(writer);
            radio2.setWidget(new LwgRectangle(100, 660, 120, 680), PdfAnnotation.HIGHLIGHT_INVERT);
            radio2.setAppearanceState("Off");
            radio2.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
            radio2.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Visa", tpOn);
            radio.addKid(radio2);
           
            PdfFormField radio3 = PdfFormField.createEmpty(writer);
            radio3.setWidget(new LwgRectangle(100, 620, 120, 640), PdfAnnotation.HIGHLIGHT_INVERT);
            radio3.setAppearanceState("Off");
            radio3.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
            radio3.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "American", tpOn);
            radio.addKid(radio3);
           
View Full Code Here

    }
    try {
      RandomAccessFileOrArray odd = new RandomAccessFileOrArray(args[0]);
      RandomAccessFileOrArray even = new RandomAccessFileOrArray(args[1]);
      LwgImage img = TiffImage.getTiffImage(odd, 1);
      LwgDocument document = new LwgDocument(new LwgRectangle(img.getScaledWidth(),
          img.getScaledHeight()));
      PdfWriter writer = PdfWriter.getInstance(document,
          new FileOutputStream(args[2]));
      document.open();
      PdfContentByte cb = writer.getDirectContent();
      int count = Math.max(TiffImage.getNumberOfPages(odd), TiffImage
          .getNumberOfPages(even));
      System.out.println("Combining 2 TIFF files into 1 PDF");
      for (int c = 0; c < count; ++c) {
        try {
          LwgImage imgOdd = TiffImage.getTiffImage(odd, c + 1);
          LwgImage imgEven = TiffImage.getTiffImage(even, count - c);
          document.setPageSize(new LwgRectangle(imgOdd.getScaledWidth(),
              imgOdd.getScaledHeight()));
          document.newPage();
          imgOdd.setAbsolutePosition(0, 0);
          cb.addImage(imgOdd);
          document.setPageSize(new LwgRectangle(imgEven.getScaledWidth(),
              imgEven.getScaledHeight()));
          document.newPage();
          imgEven.setAbsolutePosition(0, 0);
          cb.addImage(imgEven);
View Full Code Here

            tx.setBorderWidth(0);
            tx.setSubstitutionFonts(substitutionFonts);
            decodeGenericDictionary(merged, tx);
            //rect
            PdfArray rect = merged.getAsArray(PdfName.RECT);
            LwgRectangle box = PdfReader.getNormalizedRectangle(rect);
            if (tx.getRotation() == 90 || tx.getRotation() == 270)
                box = box.rotate();
            tx.setBox(box);
            if (fieldCache != null)
                fieldCache.put(fieldName, tx);
        }
        else {
View Full Code Here

            try {
                PdfDictionary wd = item.getWidget(k);
                PdfArray rect = wd.getAsArray(PdfName.RECT);
                if (rect == null)
                    continue;
                LwgRectangle r = PdfReader.getNormalizedRectangle(rect);
                int page = item.getPage(k).intValue();
                int rotation = reader.getPageRotation(page);
                ret[ptr++] = page;
                if (rotation != 0) {
                    LwgRectangle pageSize = reader.getPageSize(page);
                    switch (rotation) {
                        case 270:
                            r = new LwgRectangle(
                                pageSize.getTop() - r.getBottom(),
                                r.getLeft(),
                                pageSize.getTop() - r.getTop(),
                                r.getRight());
                            break;
                        case 180:
                            r = new LwgRectangle(
                                pageSize.getRight() - r.getLeft(),
                                pageSize.getTop() - r.getBottom(),
                                pageSize.getRight() - r.getRight(),
                                pageSize.getTop() - r.getTop());
                            break;
                        case 90:
                            r = new LwgRectangle(
                                r.getBottom(),
                                pageSize.getRight() - r.getLeft(),
                                r.getTop(),
                                pageSize.getRight() - r.getRight());
                            break;
                    }
                    r.normalize();
                }
                ret[ptr++] = r.getLeft();
View Full Code Here

            Item item = getFieldItem(field);
            if (order >= item.size())
                return null;
            int posi = order * 5;
            float[] pos = getFieldPositions(field);
            LwgRectangle box = new LwgRectangle(pos[posi + 1], pos[posi + 2], pos[posi + 3], pos[posi + 4]);
            PushbuttonField newButton = new PushbuttonField(writer, box, null);
            PdfDictionary dic = item.getMerged(order);
            decodeGenericDictionary(dic, newButton);
            PdfDictionary mk = dic.getAsDict(PdfName.MK);
            if (mk != null) {
View Full Code Here

    public static void main(String[] args) {
       
        System.out.println("StudentCard");
       
        // step 1: creation of a document-object
        LwgRectangle rect = new LwgRectangle(243, 153);
        rect.setBackgroundColor(new Color(0xFF, 0xFF, 0xCC));
        LwgDocument document = new LwgDocument(rect, 10, 10, 10, 10);
       
        try {
           
            // step 2:
View Full Code Here

TOP

Related Classes of com.lowagie.text.LwgRectangle

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.