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)); 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); } }
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)); 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); } }
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)); field.setCheckType(RadioCheckField.TYPE_CHECK); field.setBorderStyle(PdfBorderDictionary.STYLE_SOLID); //TODO Consider if we can get some more correct color field.setBorderColor(BaseColor.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); } }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { PdfContentByte cb = outputDevice.getCurrentPage(); PdfWriter writer = outputDevice.getWriter(); PdfFormField field = PdfFormField.createCheckBox(writer); Element e = box.getElement(); String onValue = getValue(e); boolean checked = isChecked(e); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); FSColor color = box.getStyle().getColor(); FSColor darker = box.getEffBackgroundColor(c).darkenColor(); createAppearances(cb, field, onValue, width, height, true, color, darker); createAppearances(cb, field, onValue, width, height, false, color, darker); field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT); field.setFieldName(getFieldName(outputDevice, e)); field.setBorderStyle(new PdfBorderDictionary(0.0f, 0)); field.setValueAsName(checked ? onValue : OFF_STATE); field.setAppearanceState(checked ? onValue : OFF_STATE); if (isReadOnly(e)) { field.setFieldFlags(PdfFormField.FF_READ_ONLY); } writer.addAnnotation(field); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { PdfContentByte cb = outputDevice.getCurrentPage(); PdfWriter writer = outputDevice.getWriter(); PdfFormField field = PdfFormField.createCheckBox(writer); Element e = box.getElement(); String onValue = getValue(e); boolean checked = isChecked(e); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); FSColor color = box.getStyle().getColor(); FSColor darker = box.getEffBackgroundColor(c).darkenColor(); createAppearances(cb, field, onValue, width, height, true, color, darker); createAppearances(cb, field, onValue, width, height, false, color, darker); field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT); field.setFieldName(getFieldName(outputDevice, e)); field.setBorderStyle(new PdfBorderDictionary(0.0f, 0)); field.setValueAsName(checked ? onValue : OFF_STATE); field.setAppearanceState(checked ? onValue : OFF_STATE); if (isReadOnly(e)) { field.setFieldFlags(PdfFormField.FF_READ_ONLY); } writer.addAnnotation(field); }