document.open();
// 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);
radio1.setWidget(new Rectangle(100, 700, 120, 720), PdfAnnotation.HIGHLIGHT_INVERT);
radio1.setAppearanceState("MasterCard");
radio1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
radio1.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "MasterCard", tpOn);
radio.addKid(radio1);
PdfFormField radio2 = PdfFormField.createEmpty(writer);
radio2.setWidget(new Rectangle(100, 660, 120, 680), PdfAnnotation.HIGHLIGHT_INVERT);
radio2.setAppearanceState("Off");
radio2.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
radio2.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Visa", tpOn);
radio.addKid(radio2);
PdfFormField radio3 = PdfFormField.createEmpty(writer);
radio3.setWidget(new Rectangle(100, 620, 120, 640), PdfAnnotation.HIGHLIGHT_INVERT);
radio3.setAppearanceState("Off");
radio3.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", tpOff);
radio3.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "American", tpOn);
radio.addKid(radio3);
writer.addAnnotation(radio);
}