Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfAppearance


       
        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.itextpdf.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.