Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfAppearance


            field.setFieldName("ATextField");
            field.setValueAsString(text);
            field.setDefaultValueAsString(text);
            field.setBorderStyle(new PdfBorderDictionary(2, PdfBorderDictionary.STYLE_SOLID));
            field.setPage();
            PdfAppearance tp = cb.createAppearance(171, 19);
            PdfAppearance da = (PdfAppearance)tp.getDuplicate();
            da.setFontAndSize(helv, fontSize);
            da.setColorFill(textColor);
            field.setDefaultAppearanceString(da);
            tp.beginVariableText();
            tp.saveState();
            tp.rectangle(2, 2, 167, 15);
            tp.clip();
View Full Code Here


           
            // step 4:
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            PdfFormField radio = PdfFormField.createRadioButton(writer, true);
            PdfAppearance tpOff = cb.createAppearance(20, 20);
            PdfAppearance tpOn = cb.createAppearance(20, 20);
           
            tpOff.circle(10, 10, 9);
            tpOff.stroke();

            tpOn.circle(10, 10, 9);
            tpOn.stroke();
            tpOn.circle(10, 10, 3);
            tpOn.fillStroke();

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

            PdfFormField radio1 = PdfFormField.createEmpty(writer);
View Full Code Here

           
            // step 4:
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            PdfFormField field = PdfFormField.createCheckBox(writer);
            PdfAppearance tpOff = cb.createAppearance(20, 20);
            PdfAppearance tpOn = cb.createAppearance(20, 20);
            tpOff.rectangle(1, 1, 18, 18);
            tpOff.stroke();
           
            tpOn.setRGBColorFill(255, 128, 128);
            tpOn.rectangle(1, 1, 18, 18);
            tpOn.fillStroke();
            tpOn.moveTo(1, 1);
            tpOn.lineTo(19, 19);
            tpOn.moveTo(1, 19);
            tpOn.lineTo(19, 1);
            tpOn.stroke();
           
            field.setWidget(new LwgRectangle(100, 700, 120, 720), PdfAnnotation.HIGHLIGHT_INVERT);
            field.setFieldName("Urgent");
            field.setValueAsName("Off");
            field.setAppearanceState("Off");
View Full Code Here

           
            // step 4:
            PdfFormField pushbutton = PdfFormField.createPushButton(writer);
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            PdfAppearance normal = cb.createAppearance(100, 50);
            normal.setColorFill(Color.GRAY);
            normal.rectangle(5, 5, 90, 40);
            normal.fill();
            PdfAppearance rollover = cb.createAppearance(100, 50);
            rollover.setColorFill(Color.RED);
            rollover.rectangle(5, 5, 90, 40);
            rollover.fill();
            PdfAppearance down = cb.createAppearance(100, 50);
            down.setColorFill(Color.BLUE);
            down.rectangle(5, 5, 90, 40);
            down.fill();           
            pushbutton.setFieldName("PushMe");
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, normal);
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_ROLLOVER, rollover);
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_DOWN, down);
            pushbutton.setWidget(new LwgRectangle(100, 700, 200, 750), PdfAnnotation.HIGHLIGHT_PUSH);
View Full Code Here

       
        float width = outputDevice.getDeviceLength(getWidth());
        float height = outputDevice.getDeviceLength(getHeight());
        float fontSize = outputDevice.getDeviceLength(font.getSize2D());
       
        PdfAppearance tp = cb.createAppearance(width, height);
        tp.setFontAndSize(font.getFontDescription().getFont(), fontSize);
       
        FSColor color = box.getStyle().getColor();
        setFillColor(tp, color);
       
        field.setDefaultAppearanceString(tp);
View Full Code Here

       
        float width = outputDevice.getDeviceLength(getWidth());
        float height = outputDevice.getDeviceLength(getHeight());
        float fontSize = outputDevice.getDeviceLength(font.getSize2D());
       
        PdfAppearance tp = cb.createAppearance(width, height);
        PdfAppearance tp2 = (PdfAppearance)tp.getDuplicate();
        tp2.setFontAndSize(font.getFontDescription().getFont(), fontSize);
       
        FSColor color = box.getStyle().getColor();
        setFillColor(tp2, color);
       
        field.setDefaultAppearanceString(tp2);
View Full Code Here

  private void createAppearances(PdfContentByte cb, PdfFormField field,
      String onValue, float width, float height, boolean normal,
      FSColor color, FSColor darker) {
    // XXX Should cache this by width and height, but they're small so
    // don't bother for now...
    PdfAppearance tpOff = cb.createAppearance(width, height);
    PdfAppearance tpOn = cb.createAppearance(width, height);

    setStrokeColor(tpOn, color);
    setStrokeColor(tpOff, color);

    float sLen = Math.min(width - reduce(width), height - reduce(height));

    if (!normal) {
        setFillColor(tpOff, darker);
      tpOff.rectangle(0, 0, width, height);
      tpOff.fill();

      setFillColor(tpOn, darker);
      tpOn.rectangle(0, 0, width, height);
      tpOn.fill();
    }

    tpOn.moveTo(width / 2 - sLen / 2, height / 2 - sLen / 2);
    tpOn.lineTo(width / 2 + sLen / 2, height / 2 + sLen / 2);
    tpOn.moveTo(width / 2 - sLen / 2, height / 2 + sLen / 2);
    tpOn.lineTo(width / 2 + sLen / 2, height / 2 - sLen / 2);
    tpOn.stroke();

    if (normal) {
      field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, OFF_STATE, tpOff);
      field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, onValue, tpOn);
    } else {
View Full Code Here

           
            // step 4:
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            PdfFormField field = PdfFormField.createCheckBox(writer);
            PdfAppearance tpOff = cb.createAppearance(20, 20);
            PdfAppearance tpOn = cb.createAppearance(20, 20);
            tpOff.rectangle(1, 1, 18, 18);
            tpOff.stroke();
           
            tpOn.setRGBColorFill(255, 128, 128);
            tpOn.rectangle(1, 1, 18, 18);
            tpOn.fillStroke();
            tpOn.moveTo(1, 1);
            tpOn.lineTo(19, 19);
            tpOn.moveTo(1, 19);
            tpOn.lineTo(19, 1);
            tpOn.stroke();
           
            field.setWidget(new Rectangle(100, 700, 120, 720), PdfAnnotation.HIGHLIGHT_INVERT);
            field.setFieldName("Urgent");
            field.setValueAsName("Off");
            field.setAppearanceState("Off");
View Full Code Here

           
            // step 4:
            PdfFormField pushbutton = PdfFormField.createPushButton(writer);
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            PdfAppearance normal = cb.createAppearance(100, 50);
            normal.setColorFill(Color.GRAY);
            normal.rectangle(5, 5, 90, 40);
            normal.fill();
            PdfAppearance rollover = cb.createAppearance(100, 50);
            rollover.setColorFill(Color.RED);
            rollover.rectangle(5, 5, 90, 40);
            rollover.fill();
            PdfAppearance down = cb.createAppearance(100, 50);
            down.setColorFill(Color.BLUE);
            down.rectangle(5, 5, 90, 40);
            down.fill();           
            pushbutton.setFieldName("PushMe");
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, normal);
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_ROLLOVER, rollover);
            pushbutton.setAppearance(PdfAnnotation.APPEARANCE_DOWN, down);
            pushbutton.setWidget(new Rectangle(100, 700, 200, 750), PdfAnnotation.HIGHLIGHT_PUSH);
View Full Code Here

            field.setFieldName("ATextField");
            field.setValueAsString(text);
            field.setDefaultValueAsString(text);
            field.setBorderStyle(new PdfBorderDictionary(2, PdfBorderDictionary.STYLE_SOLID));
            field.setPage();
            PdfAppearance tp = cb.createAppearance(171, 19);
            PdfAppearance da = (PdfAppearance)tp.getDuplicate();
            da.setFontAndSize(helv, fontSize);
            da.setColorFill(textColor);
            field.setDefaultAppearanceString(da);
            tp.beginVariableText();
            tp.saveState();
            tp.rectangle(2, 2, 167, 15);
            tp.clip();
View Full Code Here

TOP

Related Classes of com.lowagie.text.pdf.PdfAppearance

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.