-
Notifications
You must be signed in to change notification settings - Fork 10k
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
only warn on xfa if an acroform is not also present #12254
Conversation
(Related to #12217) Unfortunately I don't think this works. If XFA is present, by definition AcroForm is too since XFA is inside the AcroForm dictionary, so the condition in this statement can never happen. Refer to Lines 582 to 598 in 7edc5cb
I'm not really sure what the exact relation is between XFA and AcroForms. I have always seen forms with either only AcroForm or with AcroForm and XFA, but in the combined cases I have yet to find a PDF that wasn't fillable when we ignore XFA (which we do now). That's why I think XFA is only an extension that we can ignore, but I don't know if there are real-life examples of files where an AcroForm form cannot be filled in properly because XFA features are missing (for example to expand/show hidden form fields based on a selection of another widget). @brendandahl Do you perhaps know more about how XFA relates to AcroForm? My feeling tells me that we can safely ignore XFA completely and only log a warning for it (so no fallback bar) because I haven't seen any cases where XFA was required for filling in the form, but I'm not entirely sure. On the other hand, if such a file were to surface, we can always reconsider. TLDR; I would say we only log a warning if XFA is present and nothing else (no fallback bar). |
Hm, maybe I could check for |
If it can happen that XFA is present and the AcroForm dictionary contains no fields, then that might indeed be better since the user then correctly gets notified that filling the work definitely won't work. The question is: does the specification even allow that? |
I'm not sure -- I think @brendandahl said most xfa forms have acroforms, but some don't. The spec seems to say xfa forms should have acroforms. I pushed the fallback bar removal only change; I can push the "fallback bar if there's an xfa without acroform fields" change as well if wanted. |
I can't find it directly in the specification, but Apache PDFBox does handle the case where XFA is present and the AcroForm fields are missing; see https://github.com/apache/pdfbox/blob/e3150a327c4291654451fce149f3665fa294e498/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java#L645-L653. They call it "dynamic XFA" and I found that Wikipedia also mentions this at https://en.wikipedia.org/wiki/XFA. I think the conclusion is:
|
I tried https://gist.github.com/escapewindow/2e13c19e1ba47e25c09570e234c7f509 , and got
This is odd to me -- I'd guess if I may poke at changing |
The AcroForm fields information is not exposed because it's internal functionality (only the |
Attempted
Thanks! |
|
I have spent the majority of today figuring out how this works exactly and it's a bit more difficult than I initially thought to cover all cases, but I did find a solution that covers all known cases including the one mentioned just above. I have made #12271 with the full solution. |
Closing in favor of #12271. |
No description provided.