PDF 表单字段单选按钮语法 Latex3 生成

发布于 2025-01-16 15:56:12 字数 2602 浏览 0 评论 0原文

自从我的PDF 库有问题。它包含我所说的 PDF 规范的特殊解释,因此单选按钮在大多数查看器中无法正常工作。然而,标准可以通过多种方式解释,因此问题是:

这是一个有效的单选按钮组吗?

我看到以下几点 - 请分享您的见解:

  1. 它模仿“RadiosInUnison”行为,而不使用实际的标志(可能通过引用 Opt 数组中的相同索引)
  2. 选项数组仅包含 4 个小部件引用,而不是 6 个
  3. 选项数组的 0 索引元素的意图似乎是“备用位置” ” 对于DV 或初始 V(或者可能需要 NoToggleToOff?)
  4. Bår 的编码?
  5. ...?

这是“代码”(缩写)

51 0 obj
  <</DV /0 /FT/Btn /Ff 32768 /Kids[ 55 0 R 58 0 R 61 0 R 73 0 R 77 0 R 81 0 R ] /Opt [ (B) (Bär) (Sieglinde) (Duck) ] /T (A) /V /0 >>
endobj
55 0 obj
  <</Type /Annot /AP <</N <</1 36 0 R/Off 39 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 255 387 301 447 ] /Subtype /Widget>>
endobj
58 0 obj
  <</Type /Annot /AP <</N <</2 41 0 R /Off 43 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 313 387 348 447 ] /Subtype /Widget>>
endobj
61 0 obj
  <</Type /Annot /AP <</N <</3 45 0 R /Off 47 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 360 387 417 447 ] /Subtype /Widget>>
endobj
73 0 obj
  <</Type /Annot /AP 72 0 obj<</D <</1 66 0 R/Off 68 0 R>>/N <</1 62 0 R/Off 64 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 272 367 284 379 ] /Subtype /Widget>>
endobj
77 0 obj
  <</Type /Annot /AP <</D <</2 66 0 R/Off 68 0 R>>/N <</2 62 0 R /Off 64 0 R>>>> R /AS /Off /F 0 /Parent 51 0 R /Rect [ 325 367 336 379 ] /Subtype /Widget>>
endobj
81 0 obj
  <</Type /Annot /AP <</D <</3 66 0 R/Off 68 0 R>>/N <</3 62 0 R/Off 64 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 383 367 395 379 ] /Subtype /Widget>>
endobj

1. 根据 PDF 规范,Opt 数组为:

一个数组,其中包含单选按钮的 Kids 数组中每个小部件注释的一个条目 [...]

2. 并且

当此条目(=Opt)存在时,用于表示每个注释的 AP 字典中的开启状态的名称可以使用该注释在 Kids 中的数字位置(从 0 开始)数组 [...]

这基本上意味着索引必须匹配,对吧?

/Kids[55 0 R  58 0 R   61 0 R      73 0 R    77 0 R     81 0 R ] 
       |        |          |          |         |         |
/Opt [(B)     (Bär)   (Sieglinde) (Duck)       ?         ?    ]

3.

对于单选按钮,仅当设置了 RadiosInUnison 标志时才会发生相同的行为(检查多个小部件)。如果不设置,则一次最多设置一个字段中的单选按钮。

=>要达到示例 PDF 中检查两个单选按钮小部件的结果,必须设置 RadiosInUnison 必须 是否存在

其他违规情况? (背景:收集完所有内容后,我会通知 Latex3 人员,希望我们能改进这一点)

I stumbled over the following PDF since my PDF library has problems with it. It contains what I would call a peculiar interpretation of the PDF specification thus the radiobutton is not working correctly in most viewers. However a standard could be interpreted in many ways so the question is:

Is this a valid radiobutton group?

I see the following points - please share your insights:

  1. It mimics a 'RadiosInUnison' behavior without using the actual flag (probably by referencing the same index in the Opt array)
  2. The option array does only contain 4 widget references instead of 6
  3. The intent of the 0 index element of the option array seems to be a "standby position" for the DV or the initial V (or maybe a NoToggleToOff was desired?)
  4. Encoding of Bär?
  5. ...?

Here is the "code" (shortened)

51 0 obj
  <</DV /0 /FT/Btn /Ff 32768 /Kids[ 55 0 R 58 0 R 61 0 R 73 0 R 77 0 R 81 0 R ] /Opt [ (B) (Bär) (Sieglinde) (Duck) ] /T (A) /V /0 >>
endobj
55 0 obj
  <</Type /Annot /AP <</N <</1 36 0 R/Off 39 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 255 387 301 447 ] /Subtype /Widget>>
endobj
58 0 obj
  <</Type /Annot /AP <</N <</2 41 0 R /Off 43 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 313 387 348 447 ] /Subtype /Widget>>
endobj
61 0 obj
  <</Type /Annot /AP <</N <</3 45 0 R /Off 47 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 360 387 417 447 ] /Subtype /Widget>>
endobj
73 0 obj
  <</Type /Annot /AP 72 0 obj<</D <</1 66 0 R/Off 68 0 R>>/N <</1 62 0 R/Off 64 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 272 367 284 379 ] /Subtype /Widget>>
endobj
77 0 obj
  <</Type /Annot /AP <</D <</2 66 0 R/Off 68 0 R>>/N <</2 62 0 R /Off 64 0 R>>>> R /AS /Off /F 0 /Parent 51 0 R /Rect [ 325 367 336 379 ] /Subtype /Widget>>
endobj
81 0 obj
  <</Type /Annot /AP <</D <</3 66 0 R/Off 68 0 R>>/N <</3 62 0 R/Off 64 0 R>>>> /AS /Off /F 0 /Parent 51 0 R /Rect [ 383 367 395 379 ] /Subtype /Widget>>
endobj

1. According to the PDF spec the Opt array is:

An array containing one entry for each widget annotation in the Kids array of the radio button [...]

2. And also

When this entry (=Opt) is present, the names used to represent the on state in the AP dictionary of each annotation may use numerical position (starting with 0) of the annotation in the Kids array [...]

Which basically means that the indices must match, right?

/Kids[55 0 R  58 0 R   61 0 R      73 0 R    77 0 R     81 0 R ] 
       |        |          |          |         |         |
/Opt [(B)     (Bär)   (Sieglinde) (Duck)       ?         ?    ]

3.

For radio buttons, the same behaviour (several widgets are checked) shall occur only if the RadiosInUnison flag is set. If it is not set, at most one radio button in a field shall be set at a time.

=> to reach the result in the example PDF that two radiobutton widgets are checked the RadiosInUnison must be set

Any other violations?
(Background: After everything is collected I'll inform the latex3 guys and hopefully we'll get this improved)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半暖夏伤 2025-01-23 15:56:13
  1. 如果你想要Radiosinunison行为,你需要设置标志

来自 ISO 32000 PDF 标准:“对于单选按钮,相同
仅当设置了 RadiosInUnison 标志时才会发生该行为。如果是的话
不设置,一次最多设置一个字段中的一个单选按钮。"

  1. 不存在“/0 的虚拟索引”这样的东西,Opt 数组中的元素数量也不应该存在小于 Kids 数组中的元素数量:

来自 ISO 32000 PDF 标准:一个数组,其中包含 Kids 中每个小部件注释的一个条目
单选按钮数组 [...]

这会弄乱您的导出值,如以下查看器所示:
转移导出value

  1. Bår 的编码是错误的。应该是(Bär)。

有几种方法可以正确指定测试文档的场景:

//not using /Opt array
4 0 obj
<</FT/Btn/Ff 33587200/Kids[16 0 R 31 0 R 40 0 R 49 0 R 63 0 R 77 0 R]/T(A)>>
endobj
16 0 obj
<</AP <</N <</B#E4r 19 0 R/Off 20 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[255.191 387.106 301.307 447.484]/Subtype/Widget/Type/Annot>>
endobj
31 0 obj
<</AP <</N <</Off 34 0 R/Sieglinde 35 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[313.262 387.106 348.695 447.484]/Subtype/Widget/Type/Annot>>
endobj
40 0 obj
<</AP <</N <</Duck 43 0 R/Off 44 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[360.65 387.106 417.825 447.484]/Subtype/Widget/Type/Annot>>
endobj
49 0 obj
<</AP <</D <</B#E4r 59 0 R/Off 60 0 R>>/N <</B#E4r 53 0 R/Off 54 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[272.271 367.275 284.226 379.23]/Subtype/Widget/Type/Annot>>
endobj
63 0 obj
<</AP <</D <</Off 73 0 R/Sieglinde 74 0 R>>/N <</Off 67 0 R/Sieglinde 68 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[325.001 367.275 336.956 379.23]/Subtype/Widget/Type/Annot>>
endobj
77 0 obj
<</AP <</D <</Duck 87 0 R/Off 88 0 R>>/N <</Duck 81 0 R/Off 82 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[383.26 367.275 395.215 379.23]/Subtype/Widget/Type/Annot>>
endobj

或者

//With /Opt array
4 0 obj
<</FT/Btn/Ff 33587200/Kids[16 0 R 31 0 R 40 0 R 49 0 R 63 0 R 77 0 R]/Opt[(Bär)(Sieglinde)(Duck)(Bär)(Sieglinde)(Duck)]/T(A)/V/Off>>
endobj
16 0 obj
<</AP <</N <</0 19 0 R/Off 20 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[255.191 387.106 301.307 447.484]/Subtype/Widget/Type/Annot>>
endobj
31 0 obj
<</AP <</N <</1 34 0 R/Off 35 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[313.262 387.106 348.695 447.484]/Subtype/Widget/Type/Annot>>
endobj
40 0 obj
<</AP <</N <</2 43 0 R/Off 44 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[360.65 387.106 417.825 447.484]/Subtype/Widget/Type/Annot>>
endobj
49 0 obj
<</AP <</D <</0 59 0 R/Off 60 0 R>>/N <</0 53 0 R/Off 54 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[272.271 367.275 284.226 379.23]/Subtype/Widget/Type/Annot>>
endobj
63 0 obj
<</AP <</D <</1 73 0 R/Off 74 0 R>>/N <</1 67 0 R/Off 68 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[325.001 367.275 336.956 379.23]/Subtype/Widget/Type/Annot>>
endobj
77 0 obj
<</AP <</D <</2 87 0 R/Off 88 0 R>>/N <</2 81 0 R/Off 82 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[383.26 367.275 395.215 379.23]/Subtype/Widget/Type/Annot>>
endobj
  1. If you want Radiosinunison behavior you need to set the flag

From the ISO 32000 PDF Standard: "For radio buttons, the same
behaviour shall occur only if the RadiosInUnison flag is set. If it is
not set, at most one radio button in a field shall be set at a time."

  1. There is no such thing as a "dummy index for /0" nor should the number of elements in the Opt array be smaller than the number of elements in the Kids array:

From the ISO 32000 PDF Standard: An array containing one entry for each widget annotation in the Kids
array of the radio button [...]

This messes up your export values as shown in the following viewer:
Shifted export values

  1. The encoding for Bär is wrong. Should be (Bär).

There are several possibilities to correctly specify the scenario of your test document:

//not using /Opt array
4 0 obj
<</FT/Btn/Ff 33587200/Kids[16 0 R 31 0 R 40 0 R 49 0 R 63 0 R 77 0 R]/T(A)>>
endobj
16 0 obj
<</AP <</N <</B#E4r 19 0 R/Off 20 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[255.191 387.106 301.307 447.484]/Subtype/Widget/Type/Annot>>
endobj
31 0 obj
<</AP <</N <</Off 34 0 R/Sieglinde 35 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[313.262 387.106 348.695 447.484]/Subtype/Widget/Type/Annot>>
endobj
40 0 obj
<</AP <</N <</Duck 43 0 R/Off 44 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[360.65 387.106 417.825 447.484]/Subtype/Widget/Type/Annot>>
endobj
49 0 obj
<</AP <</D <</B#E4r 59 0 R/Off 60 0 R>>/N <</B#E4r 53 0 R/Off 54 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[272.271 367.275 284.226 379.23]/Subtype/Widget/Type/Annot>>
endobj
63 0 obj
<</AP <</D <</Off 73 0 R/Sieglinde 74 0 R>>/N <</Off 67 0 R/Sieglinde 68 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[325.001 367.275 336.956 379.23]/Subtype/Widget/Type/Annot>>
endobj
77 0 obj
<</AP <</D <</Duck 87 0 R/Off 88 0 R>>/N <</Duck 81 0 R/Off 82 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[383.26 367.275 395.215 379.23]/Subtype/Widget/Type/Annot>>
endobj

OR

//With /Opt array
4 0 obj
<</FT/Btn/Ff 33587200/Kids[16 0 R 31 0 R 40 0 R 49 0 R 63 0 R 77 0 R]/Opt[(Bär)(Sieglinde)(Duck)(Bär)(Sieglinde)(Duck)]/T(A)/V/Off>>
endobj
16 0 obj
<</AP <</N <</0 19 0 R/Off 20 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[255.191 387.106 301.307 447.484]/Subtype/Widget/Type/Annot>>
endobj
31 0 obj
<</AP <</N <</1 34 0 R/Off 35 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[313.262 387.106 348.695 447.484]/Subtype/Widget/Type/Annot>>
endobj
40 0 obj
<</AP <</N <</2 43 0 R/Off 44 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[360.65 387.106 417.825 447.484]/Subtype/Widget/Type/Annot>>
endobj
49 0 obj
<</AP <</D <</0 59 0 R/Off 60 0 R>>/N <</0 53 0 R/Off 54 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[272.271 367.275 284.226 379.23]/Subtype/Widget/Type/Annot>>
endobj
63 0 obj
<</AP <</D <</1 73 0 R/Off 74 0 R>>/N <</1 67 0 R/Off 68 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[325.001 367.275 336.956 379.23]/Subtype/Widget/Type/Annot>>
endobj
77 0 obj
<</AP <</D <</2 87 0 R/Off 88 0 R>>/N <</2 81 0 R/Off 82 0 R>>>>/AS/Off/MK<</CA(l)>>/P 14 0 R/Parent 4 0 R/Rect[383.26 367.275 395.215 379.23]/Subtype/Widget/Type/Annot>>
endobj
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文