Get field value for the check box

自闭症网瘾萝莉.ら 提交于 2020-01-05 08:36:10

问题


How to find the field value for the check box?

<</Rect[263.571 330.311 273.323 338.812]/Subtype/Widget/F 4/P 30 0 R/T(AmountCollect)/DA(/ZaDb 18 Tf 0 g)/FT/Btn/Type/Annot/MK<</CA(8)>>/AP<</D<</COLLECT 148 0 R/Off 149 0 R>>/N<</COLLECT 147 0 R>>>>/AS/Off>>

I tried the following. But I am unable to mark the check box. Please help.

 testForm.SetField("AmountCollect", "Off");
 testForm.SetField("AmountCollect", "Yes");
 testForm.SetField("AmountCollect", "0");

回答1:


If the string values you're using aren't working, the check box probably uses different names for the appearance state. You can find the possible values of the appearance state using the GetAppearanceStates (see the Buttons example), or you can use iText RUPS to inspect the PDF and search for the names of the appearance states using a GUI.

PS: you can find the C# version of the examples of chapter 8 here.




回答2:


testForm.SetField("AmountCollect", "COLLECT"); worked for me.

Reference post : Get the export value of a checkbox using iTextSharp



来源:https://stackoverflow.com/questions/19367041/get-field-value-for-the-check-box

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!