List of usage examples for com.lowagie.text.pdf PdfFormField setBorderStyle
public void setBorderStyle(PdfBorderDictionary border)
From source file:org.xhtmlrenderer.pdf.RadioButtonFormField.java
License:Open Source License
private void createField(RenderingContext c, ITextOutputDevice outputDevice, PdfContentByte cb, PdfWriter writer, PdfFormField group, RadioButtonFormField fieldElem, RadioButtonFormField checked) { Box box = fieldElem.getBox(); Element e = box.getElement(); String onValue = getValue(e); float width = outputDevice.getDeviceLength(fieldElem.getWidth()); float height = outputDevice.getDeviceLength(fieldElem.getHeight()); PdfFormField field = PdfFormField.createEmpty(writer); 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.createTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT); // XXX createTargetArea already looks up the page, but hopefully a document // won't have enough radio buttons to matter Rectangle bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); PageBox page = c.getRootLayer().getPage(c, bounds.y); field.setPlaceInPage(page.getPageNo() + 1); field.setBorderStyle(new PdfBorderDictionary(0.0f, 0)); field.setAppearanceState(fieldElem == checked ? onValue : OFF_STATE); if (isReadOnly(e)) { field.setFieldFlags(PdfFormField.FF_READ_ONLY); }// w w w . j ava 2 s . c o m group.addKid(field); }