pdf-association/arlington-pdf-model

AS is always required in Widget annotations

bdoubrov opened this issue · 5 comments

AnnotWidget.tsv currently specifies that the AS entry is required if fn:IsRequired(fn:IsPresent(AP::N::*) || fn:IsPresent(AP::R::*) || fn:IsPresent(AP::D::*)).

This corresponds to the following phrase from PDF spec: AS is "Required if the appearance dictionary AP contains one or more subdictionaries". However, for example, the condition fn:IsPresent(AP::N::*) evaluates to true for AP entry having value of type dictionary or stream. So, as a result, AS entry is always required, which is not correct.

And I don't immediately see how to fix this within the current grammar.

Maybe I misunderstand: where is AP defined to be a stream?
Table 166 defines AP only as a dictionary, which is a dictionary defined by Table 170 (N, R, D entries with only N required)

Sorry, I meant that the condition fn:IsPresent(AP::N::*) evaluates to true for AP::N entry having value of type dictionary or stream. While according to the specification AS entry is required only if AP::N (or one of AP::R, AP::D) is a dictionary.

Thanks - understood. As you know I like to keep things closely aligned with the phrasing used in 32K so I think this would work:

fn:IsRequired(fn:IsDictionary(AP::N) || fn:IsDictionary(AP::R) || fn:IsDictionary(AP::D))

where fn:IsDictionary is a new predicate that asserts that a key is both present and a dictionary.
What do you think?

Yes, adding the predicate IsDictionary is certainly a solution.

In fact, this issue shows up in all Annotation types, not just Widget annotation