Example usage for com.lowagie.text.pdf RadioCheckField TYPE_CHECK

List of usage examples for com.lowagie.text.pdf RadioCheckField TYPE_CHECK

Introduction

In this page you can find the example usage for com.lowagie.text.pdf RadioCheckField TYPE_CHECK.

Prototype

int TYPE_CHECK

To view the source code for com.lowagie.text.pdf RadioCheckField TYPE_CHECK.

Click Source Link

Document

A field with the symbol check

Usage

From source file:buckley.compile.CheckboxFieldFactory.java

License:Apache License

public PdfFormField buildFormField(RadioCheckField field) throws IOException, DocumentException {
    field.setCheckType(RadioCheckField.TYPE_CHECK);
    field.setChecked(false);//from  ww w. ja va  2s.  c  o  m
    return field.getCheckField();
}

From source file:com.geek.tutorial.itext.acroform.RadioCheckBoxForm.java

License:Open Source License

private static void addRadioButton(PdfWriter writer, Rectangle rect, PdfFormField radio, String name,
        boolean on) throws IOException, DocumentException {
    RadioCheckField check = new RadioCheckField(writer, rect, null, name);
    check.setCheckType(RadioCheckField.TYPE_CHECK);
    check.setBorderColor(Color.BLACK);
    check.setChecked(on);/*from w  w  w.j a va  2  s .  c  om*/
    radio.addKid(check.getRadioField());
}

From source file:org.xhtmlrenderer.pdf.CheckboxFormField.java

License:Open Source License

public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) {
    PdfContentByte cb = outputDevice.getCurrentPage();

    PdfWriter writer = outputDevice.getWriter();
    Element elm = box.getElement();

    Rectangle targetArea = outputDevice.createLocalTargetArea(c, box);
    String onValue = getValue(elm);

    RadioCheckField field = new RadioCheckField(writer, targetArea, getFieldName(outputDevice, elm), onValue);

    field.setChecked(isChecked(elm));/*from   w w w.j av a  2s .c  om*/
    field.setCheckType(RadioCheckField.TYPE_CHECK);
    field.setBorderStyle(PdfBorderDictionary.STYLE_SOLID);
    //TODO Consider if we can get some more correct color
    field.setBorderColor(Color.black);

    field.setBorderWidth(BaseField.BORDER_WIDTH_THIN);

    try {
        PdfFormField formField = field.getCheckField();
        if (isReadOnly(elm)) {
            formField.setFieldFlags(PdfFormField.FF_READ_ONLY);
        }
        writer.addAnnotation(formField);
    } catch (IOException ioe) {
        System.out.println(ioe);
    } catch (DocumentException de) {
        System.out.println(de);
    }

}