Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AS is always required in Widget annotations #61

Open
bdoubrov opened this issue Apr 14, 2023 · 5 comments
Open

AS is always required in Widget annotations #61

bdoubrov opened this issue Apr 14, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@bdoubrov
Copy link
Collaborator

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.

@petervwyatt
Copy link
Member

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)

@bdoubrov
Copy link
Collaborator Author

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.

@petervwyatt
Copy link
Member

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?

@petervwyatt petervwyatt self-assigned this Apr 19, 2023
@petervwyatt petervwyatt added the bug Something isn't working label Apr 19, 2023
@bdoubrov
Copy link
Collaborator Author

Yes, adding the predicate IsDictionary is certainly a solution.

@bdoubrov
Copy link
Collaborator Author

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

@petervwyatt petervwyatt added this to the PDF Data Model milestone Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants