-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[api-minor] Add the possibility to collect Javascript actions #12429
Conversation
fcbe180
to
b247073
Compare
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.
Based on a very cursory look, I've added a few quick comments.
I'm missing some context for this patch. Which issue does this solve? Why are we interested in collecting this information, and what is it used for? |
I'll fix the nits tomorrow: thanks for that. |
f2286d8
to
6045c63
Compare
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.
Sorry, but the API implemented here is really not correct!
Similar to the regular getAnnotations
method, which lives on the page rather than the document, this new API-method must also be on the page-level.
Please keep in mind that the PDF.js library is written such that data can be loaded when needed, using e.g. range requests and streaming, to explicitly not require that the entire document is loaded in order for rendering to start (see e.g. the disableAutoFetch
option).
Hence we really can't/shouldn't add an API-method that essentially forces the entire document to load and all pages to be parsed, which would be particularly bad when invoked from the viewer. (It would force a lot of data to be requested very early on, possibly affecting general viewer performance negatively when loading longer documents.)
I thought about that of course and the problem is when a script is getting a value from a Field which hasn't been rendered: we can't await for its value. What we can do:
|
I moved the data collection stuff in PDFDocument in using Fields entry from Acroform dictionary. |
I suppose I still don't really understand why this, similar to annotations in general, cannot be parsed on a page-by-page basis!? (Generally speaking, given the lack of context/information in the commit message it's quite difficult to get a good overview of the entire situation and e.g. understand why you went with a particular approach.) |
Yes exactly
My bad, you're right, sorry about that. |
Can we move forward on this patch please ? |
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.
Now that it's finally clear to me why the extra method is needed, I think this approach can be used now with these comments addressed, in particular to add some documentation on why they are there (see the comment below).
af0f193
to
cf451a1
Compare
dea74f0
to
932f441
Compare
/botio unittest |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/73449564b1e981f/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @timvandermeij received. Current queue size: 1 Live output at: http://54.215.176.217:8877/04c5dc96f5a5eb5/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/73449564b1e981f/output.txt Total script time: 4.26 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/04c5dc96f5a5eb5/output.txt Total script time: 5.22 mins
|
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.
Approved pending these final comments now that I did a full review, and passing tests afterwards (ignore the intermittent one above). Thanks!
932f441
to
71ecc31
Compare
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.
Seems fine to me too, with just one more question; please see #12429 (comment)
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.215.176.217:8877/c25b840b1a5ae14/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/c2770e8bee80edb/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/c2770e8bee80edb/output.txt Total script time: 25.80 mins
Image differences available at: http://54.67.70.0:8877/c2770e8bee80edb/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/c25b840b1a5ae14/output.txt Total script time: 31.36 mins
Image differences available at: http://54.215.176.217:8877/c25b840b1a5ae14/reftest-analyzer.html#web=eq.log |
Nice work! |
No description provided.