Java iText和自定义Radiobutton行为 [英] Java iText and custom Radiobutton behaviour

查看:141
本文介绍了Java iText和自定义Radiobutton行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iText 2.1.7。
我在表格单元格中有三个单选按钮。

I am using iText 2.1.7. I have three radiobuttons in a table cell.

初始所有按钮(b1,b2和b3)未选中。

Initial all buttons (b1, b2 and b3) are unchecked.

所需行为:

如果检查b1:b2& b3取消选中

If Check b1: b2 & b3 to uncheck

如果检查b2:b1取消选中

If Check b2: b1 to uncheck

如果检查b3:b1取消选中

If Check b3: b1 to uncheck

因此可以同时检查b2和b3。

So b2 and b3 can be checked at the same time.

此外我希望所有按钮都可以切换为关闭再次。

Additionally i want that all buttons can be toggled to off again.

我怎样才能实现这种行为?
帮助赞赏!

How can i achieve that behaviour? Help appreciated!

推荐答案

在我完全回答你的问题之前看一下示例行为 - 就是你的意思想?你有一个包含现有字段的PDF,或者你想新添加这些字段吗?

Before I fully answer your question have a look a the example behavior - is that what you want? Do you have an PDF with existing fields or do you want to newly add those fields?

该解决方案不使用javascript。

The solution does not use javascript.

1. Create a checkbox with 3 kids
1 0 obj
<</DA(/ZaDb 0 Tf 0 g)/FT/Btn/Kids[14 0 R 19 0 R 24 0 R]/T(checkbox1)>>
endobj

2. Create the 3 kids with values 1xb1 and 2xb2
14 0 obj
<</AP<</b1 18 0 R>>/N<</Off 15 0 R/b1 16 0 R>>>>/AS/Off/F 4/MK<</CA(8)>>/P 12 0 R/Parent 1 0 R/Rect[122 723 140 740]/Subtype/Widget/Type/Annot>>
endobj

19 0 obj
<</AP<</b2 23 0 R>>/N<</Off 20 0 R/b2 21 0 R>>>>/AS/Off/F 4/MK<</CA(8)>>/P 12 0 R/Parent 1 0 R/Rect[145 722 162 739]/Subtype/Widget/Type/Annot>>
endobj

24 0 obj
<</AP<</b2 28 0 R>>/N<</Off 25 0 R/b2 26 0 R>>>>/AS/Off/F 4/MK<</CA(8)>>/P 12 0 R/Parent 1 0 R/Rect[167 721 185 738]/Subtype/Widget/Type/Annot>>
endobj

更新:您可以找到解决方案如何将新的检查点完全添加到PDF 此处

Update: You can find the solution how to completely add new checkoxes to a PDF here.

这篇关于Java iText和自定义Radiobutton行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆