Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfAppearance


           
            // 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


       
        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

            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);    
       
        float diameter = Math.min(width, height);
       
        setStrokeColor(tpOff, color);
        setStrokeColor(tpOn, color);
       
        if (! normal) {
            setStrokeColor(tpOff, darker);
            setStrokeColor(tpOn, darker);
        }
       
        float strokeWidth = Math.max(1.0f, reduce(diameter));
       
        tpOff.setLineWidth(strokeWidth);
        tpOn.setLineWidth(strokeWidth);
       
        tpOff.circle(width / 2, height / 2, diameter / 2 - strokeWidth / 2);
        tpOn.circle(width / 2, height / 2, diameter / 2 - strokeWidth / 2);
       
        if (! normal) {
            tpOff.fillStroke();
            tpOn.fillStroke();
        } else {
            tpOff.stroke();
            tpOn.stroke();
        }
       
        setFillColor(tpOn, color);
        if (! normal) {
            tpOn.circle(width / 2, height / 2, diameter * 0.23f);
        } else {
            tpOn.circle(width / 2, height / 2, diameter * 0.20f);
        }
        tpOn.fill();
       
        if (normal) {
            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, OFF_STATE, tpOff);
            field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, onValue, tpOn);
        } else {
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.