-
Notifications
You must be signed in to change notification settings - Fork 10.3k
JS - Avoid a popup to ask for specific version of Acrobat #14207
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
Conversation
I have tested that via:
Hope its all good 😊 |
As a general rule: Please make sure to provide more context in the commit message as well, such that the information also becomes available on the Git command line.
In order to save your time: Please note that |
src/scripting_api/app.js
Outdated
@@ -22,7 +22,7 @@ import { Thermometer } from "./thermometer.js"; | |||
const VIEWER_TYPE = "PDF.js"; | |||
const VIEWER_VARIATION = "Full"; | |||
const VIEWER_VERSION = "10.0"; | |||
const FORMS_VERSION = undefined; | |||
const FORMS_VERSION = "11.001"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the scripting-spec, see https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_jsapiref.pdf#G4.1992920, the value returned by the formsVersion
getter should be a number. Hence shouldn't this constant thus be a number as well?
@calixteman What's correct here, since according to this the existing VIEWER_VERSION
constant is also the wrong type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep that's correct: they're both numbers.
I checked the values in Acrobat DC and they're both equal to 21.00720099.
I looked in pdfium source code and they're using 7 for the formsVersion, when they're using 8 or 11 for viewerVersion depending of the context (xfa or not).
@Snuffleupagus, what do you think we should choose for those values ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the practical effect of choosing "too large" values here; that we sort-of claim to support various scripting features that we perhaps haven't actually implemented? (I'm guessing this might already be the case though...)
Anyway, going with the larger values seem nice since that would mean that we don't unnecessarily bother users with warnings upon loading of documents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sorry, I figure out its a number but was relating to VIEWER_VISION and thats why decided to go with the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think it's better to have a large number for the reasons you mentioned (this is my opinion and it's conform with the Mozilla policy).
Is the value 21 ok for you ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the value 21 ok for you ?
That seems fine by me!
@Snuffleupagus no problem, I though it should be one-line commit messages to keep it simple and not clogged. |
The first line of the commit message should indeed be a short summary of the changes in the patch. However, you're then free to add additional lines with more information (as much as you think is helpful/useful) to the commit message. You might want to look at some older commit messages, e.g. in https://github.com/mozilla/pdf.js/commits/master, to see how this is often done.
Both seem like a good idea to me. Something I always find helpful, when writing a commit message, is to imagine that you're reading it yourself in e.g. a months time (on the Git command line): Does the commit message clearly explain the problem that's being solved and why the patch is implemented like it is? |
Embedded JS in PDF keep throwing alert reagdring specific version of Acrobat (Spanish and version 5.0 or greater). This happens because: - JS in pdf is enabled - PDF contains some unsupported features (e.g. XFA) Alert come when app.formVersion = undefined || app.formVersion < 5.0 In pdf.js we were using FORM_VERSION = undefined. After researching based on https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_jsapiref.pdf\#G4.1993509 and Acrobat DC we decided to go with the larger number to avoid unnecessary popups. Through investigation we realise that VIEWER_VERSION should have same value - a number. Due to all that, we implemented 21.00720099 as a value for both FORMS_VERSION and VIEWER_VERSION
0e6e2f7
to
12f89d2
Compare
@Snuffleupagus thanks heaps, your advice of future time was really helpful. Changed the commit msg, its more descriptive now :) |
@calixteman Do we have a good/simple way of testing that an /botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/99f88ff6afe20a1/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 1 Live output at: http://54.193.163.58:8877/76011312febb158/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/99f88ff6afe20a1/output.txt Total script time: 3.84 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/76011312febb158/output.txt Total script time: 6.35 mins
|
Some actions are ran when the document is open: pdf.js/src/scripting_api/doc.js Lines 100 to 114 in ec1633c
and alert is defined here:pdf.js/src/scripting_api/app.js Line 429 in ec1633c
and the app object has access to the doc .So it's easy to add a flag in the doc in order to know if we are in the "open" process and disable alert when this flag is true.
We can disable the popups at loading time but if one contains an information of interest (e.g. "Don't forget to fill whatever before sending the form"), the user will miss it. So I think we could land that stuff as it is and I can ask to Product/UX/UI people what they think about disabling all popups at loading. @Snuffleupagus does that work for you ? |
Sure, that sounds good to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for doing this.
Because
Popup keep asking regarding specific version of Acrobat (Spanish and version 5.0 or greater).
That happens because:
By searching through pdf source code I have found that there is an embedded JS in pdf throws error & alert, if
Regarding documents in https://helpx.adobe.com/livecycle/help/mobile-forms/scripting-support.html for Scripting Support,
Issue that this pull request solves
Closes: #14206