应用场景
java使用itext生成PDF,需要在PDF图片或者签章添加点击事件或者鼠标悬浮显示指定信息
try {
Image img = Image.getInstance("C:\\Users\\Administrator\\Desktop\\muxuzi.jpg");
PushbuttonField btn = new PushbuttonField(writer, new Rectangle(100, 100, 200, 200), "Button1");
String showText = "姓 名: 勇气heart \n"
+"身份证号: 666666666666666666\n"
+"签署日期: 2018年05月25日\n"
+"签署密文 : adsf;lksdjfcljcvlakdsjf;lkasdsadjfosdjfasddofjdsfkj";
String tip = "6666";
btn.setText(showText);
btn.setBackgroundColor(BaseColor.GRAY);
btn.setImage(img);
btn.setFontSize(0);
btn.setLayout(PushbuttonField.LAYOUT_ICON_ONLY);//只要图片
// btn.setLayout(PushbuttonField.LAYOUT_ICON_LEFT_LABEL_RIGHT);//图片在左,注释在右
btn.setLayout(PushbuttonField.VISIBLE_BUT_DOES_NOT_PRINT);//可视但不打印
btn.setBorderStyle(P