1 2 3 4 5 6 7 8 9 10 11 12
| PdfAppearance normal= PdfAppearance.createAppearance(writer,100, 100);
normal.setColorFill(Color.BLUE);
normal.rectangle(5,5,90,40);
normal.fill();
PdfFormField pushbutton= PdfFormField.createPushButton(writer);
pushbutton.setFieldName("clic");
pushbutton.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,normal);
pushbutton.setColor(new Color(251 ,51 ,51));
pushbutton.setWidget(new Rectangle(50,50,50,50),PdfAnnotation.HIGHLIGHT_PUSH);
pushbutton.setAction(PdfAction.javaScript("this.showButtonState()",writer));
writer.addAnnotation(pushbutton); |
Partager