FDF -如何检查复选框?

时间:2023-02-07 10:03:56

I'm using FDF to populate a PDF template. On my PDF template, I have a checkbox and radio field called c1 and r1 respectively. What's the syntax I should use in my FDF file to check or select the c1 and r1 field?

我使用FDF来填充PDF模板。在我的PDF模板上,我分别有一个复选框和一个名为c1和r1的广播字段。我应该在FDF文件中使用什么语法来检查或选择c1和r1字段?

I tried things like

我试着像

<</T(c1)/V(1)>>
<</T(c1)/V(checked)>>
<</T(c1)/V(on)>>
<</T(c1)/V(true)>>

But none of them work.

但是没有一个是有效的。

5 个解决方案

#1


17  

I found the answer. To check, use

我找到了答案。检查,使用

<</T(c1)/V(Yes)>>

To turn off, use

关掉,使用

<</T(c1)/V(Off)>>

I found the answer on this page: http://www.4dcodeexchange.net/fdfformbuilder.htm

我在这一页找到了答案:http://www.4dcodeexchange.net/fdfformbuilder.htm。

Excerpt

摘录

Checkboxes come in 2 flavors grouped and individual. Individual checkboxes will usually have a value of "Yes" or "Off". Grouped checkboxes are different in that each checkbox will have its own value. If you have problems with your FDF, look here first.

复选框分为两种类型,分组和个人。单个复选框通常具有“Yes”或“Off”的值。分组的复选框不同,每个复选框都有自己的值。如果你的FDF有问题,先看这里。

#2


9  

Just to make a precision. It seems that to check an individual checkbox you need to use the export value you set when creating your box in Acrobat. This value is, indeed, by default to "Yes"

只是为了精确。似乎要检查单个复选框,您需要使用在Acrobat中创建您的框时设置的导出值。这个值默认为"Yes"

#3


6  

The value passed to check the box is often "Yes" and "Off" - However, this is only the default value and it can be changed from "Yes" to almost any value at all (this is controlled by the export value of the document, as pointed out by others).

传递给复选框的值通常是“Yes”和“Off”——然而,这只是默认值,它可以从“Yes”更改为几乎所有值(这是由文档的导出值控制的,正如其他人所指出的)。

If you are looking to procedurally get the on/checked state value (which you will need to reliably set this checkbox as checked), it is contained in the appearances "AP" dictionary of the field. That dictionary should contain another dictionary "N", and each key is one of two values for the checkbox. The first key will be the unchecked value (usually "Off") and the second key will be the checked value (usually "Yes"). How you do this entirely depends on the API.

如果您想从程序上获得on/checked状态值(您需要可靠地将这个复选框设置为选中),那么它就包含在字段的“AP”字典中。那个字典应该包含另一个字典“N”,每个键是复选框的两个值中的一个。第一个键将是未检查的值(通常是“Off”),第二个键将是选中的值(通常是“Yes”)。如何做到这一点完全取决于API。

If you use pdftk from the command line, you can see what the expected values are using the command dump_data_fields: Eg.

如果您从命令行使用pdftk,您可以看到使用命令dump_data_fields时所期望的值:Eg。

pdftk document.pdf dump_data_fields 

Will show something like this:

会出现这样的情况:

---
FieldType: Button
FieldName: basform
FieldFlags: 0
FieldValue: No
FieldJustification: Left
FieldStateOption: Off
FieldStateOption: basic_forms            <---- Checked value expected by FDF

Here we can see that the checked state is actually expecting "basic_forms" and not "Yes". I believe the other state is always "Off", but that may depend on the language your program is using (the default "Yes" value certainly does).

在这里,我们可以看到检查状态实际上期望的是“basic_forms”而不是“Yes”。我相信另一个状态总是“Off”,但这可能取决于程序使用的语言(默认的“Yes”值确实是这样)。

#4


0  

For me works:

对我来说工作原理:

<</T(c1)/V(0)>>

for checked values and

检查值和

<</T(c1)/V(Off)>>

values by default.

默认值。

#5


-1  

Yes From JAVA ALSO we can pass value "Yes" to check the checkbox in pdf or fdf thanks.... Rachit Shah

是的,从JAVA我们也可以通过价值“是”复选框以pdf或fdf谢谢....Rachit沙

#1


17  

I found the answer. To check, use

我找到了答案。检查,使用

<</T(c1)/V(Yes)>>

To turn off, use

关掉,使用

<</T(c1)/V(Off)>>

I found the answer on this page: http://www.4dcodeexchange.net/fdfformbuilder.htm

我在这一页找到了答案:http://www.4dcodeexchange.net/fdfformbuilder.htm。

Excerpt

摘录

Checkboxes come in 2 flavors grouped and individual. Individual checkboxes will usually have a value of "Yes" or "Off". Grouped checkboxes are different in that each checkbox will have its own value. If you have problems with your FDF, look here first.

复选框分为两种类型,分组和个人。单个复选框通常具有“Yes”或“Off”的值。分组的复选框不同,每个复选框都有自己的值。如果你的FDF有问题,先看这里。

#2


9  

Just to make a precision. It seems that to check an individual checkbox you need to use the export value you set when creating your box in Acrobat. This value is, indeed, by default to "Yes"

只是为了精确。似乎要检查单个复选框,您需要使用在Acrobat中创建您的框时设置的导出值。这个值默认为"Yes"

#3


6  

The value passed to check the box is often "Yes" and "Off" - However, this is only the default value and it can be changed from "Yes" to almost any value at all (this is controlled by the export value of the document, as pointed out by others).

传递给复选框的值通常是“Yes”和“Off”——然而,这只是默认值,它可以从“Yes”更改为几乎所有值(这是由文档的导出值控制的,正如其他人所指出的)。

If you are looking to procedurally get the on/checked state value (which you will need to reliably set this checkbox as checked), it is contained in the appearances "AP" dictionary of the field. That dictionary should contain another dictionary "N", and each key is one of two values for the checkbox. The first key will be the unchecked value (usually "Off") and the second key will be the checked value (usually "Yes"). How you do this entirely depends on the API.

如果您想从程序上获得on/checked状态值(您需要可靠地将这个复选框设置为选中),那么它就包含在字段的“AP”字典中。那个字典应该包含另一个字典“N”,每个键是复选框的两个值中的一个。第一个键将是未检查的值(通常是“Off”),第二个键将是选中的值(通常是“Yes”)。如何做到这一点完全取决于API。

If you use pdftk from the command line, you can see what the expected values are using the command dump_data_fields: Eg.

如果您从命令行使用pdftk,您可以看到使用命令dump_data_fields时所期望的值:Eg。

pdftk document.pdf dump_data_fields 

Will show something like this:

会出现这样的情况:

---
FieldType: Button
FieldName: basform
FieldFlags: 0
FieldValue: No
FieldJustification: Left
FieldStateOption: Off
FieldStateOption: basic_forms            <---- Checked value expected by FDF

Here we can see that the checked state is actually expecting "basic_forms" and not "Yes". I believe the other state is always "Off", but that may depend on the language your program is using (the default "Yes" value certainly does).

在这里,我们可以看到检查状态实际上期望的是“basic_forms”而不是“Yes”。我相信另一个状态总是“Off”,但这可能取决于程序使用的语言(默认的“Yes”值确实是这样)。

#4


0  

For me works:

对我来说工作原理:

<</T(c1)/V(0)>>

for checked values and

检查值和

<</T(c1)/V(Off)>>

values by default.

默认值。

#5


-1  

Yes From JAVA ALSO we can pass value "Yes" to check the checkbox in pdf or fdf thanks.... Rachit Shah

是的,从JAVA我们也可以通过价值“是”复选框以pdf或fdf谢谢....Rachit沙