-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Render not displayed annotations in using normal appearance when printing #12395
Conversation
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.
Do you have a PDF file to test this with? Even though the unit tests cover the cases and adding a reference test is not really possible, it would be good for me to verify this in the viewer itself.
https://www.canada.ca/content/dam/ircc/migration/ircc/english/passport/forms/pdf/pptc155.pdf Save something on page 3 and reopen the newly created file and print. |
Why is that though, since based on the description in #12395 (comment) I'd sort of expect that an
|
I thought so because of the "since they were not rendered in annotation_layer" part. If we add a reference test we have to render the page and I thought this bug would not show up then. I might be wrong here and I see that a test is now added, so we should verify if this indeed catches the bug. |
This PR needs a rebase. |
489a57f
to
589b18d
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.
Finally had some time to review this; sorry for the delay. Looks good with these final comments resolved, the most important one being the reference test that doesn't seem to work.
"type": "eq", | ||
"print": true, | ||
"annotationStorage": { | ||
"1605R": true |
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.
I verified that this patch itserlf fixes the reported issue, but I can't get this reference test working when checking out this patch and I also don't see how this is supposed to work. The prefilled file seems to only have prefilled content on page 1 and this page is always rendered, so there is an annotation layer and the content is simply in the annotation storage. Checkbox 1605R is also on the first page, so that will also work. I don't see any changes in the output before/after this patch, which confirms my suspicion that this most likely doesn't work as expected.
Did you try the suggestion from #12395 (comment)? You can run the reference tests locally before/after applying this patch to check if the test indeed works as expected.
Since I found that your steps in #12395 (comment) do work, perhaps this test can be made in the same way by providing a PDF with text prefilled on page 3 and then printing it?
src/core/annotation.js
Outdated
const value = annotationStorage[this.data.id]; | ||
if (value === undefined) { | ||
// No change |
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.
undefined
actually means "not rendered" because otherwise the value would be false/true depending on the checked state. Given that we also don't have this comment in WidgetAnnotation.save
, I'd say we can just remove this line here and in _saveRadioButton
below.
@calixteman Since form support is getting close to being enabled upstream, it would be great if we can get this PR merged. For the reference test, I recommend to run |
It should be ok now, sorry for the delay. |
/botio-linux test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/4c26b560f7fe076/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/4c26b560f7fe076/output.txt Total script time: 2.40 mins
Image differences available at: http://54.67.70.0:8877/4c26b560f7fe076/reftest-analyzer.html#web=eq.log |
Did the PDF file change? If so, the hash also needs to be changed in the test manifest. |
My bad, I fixed it, sorry. |
Oh, that's indeed not the fault of this PR. We'll look into that. |
Node.js 14 became LTS today, causing the CI builds to fail because the caches still contained packages for the previous LTS version. Purging the cache and retriggering the CI build fixed the issue. |
/botio-linux test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/1e5bacfcc405f09/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/1e5bacfcc405f09/output.txt Total script time: 24.93 mins
Image differences available at: http://54.67.70.0:8877/1e5bacfcc405f09/reftest-analyzer.html#web=eq.log |
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/f7a1bbf174f8bef/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/f7a1bbf174f8bef/output.txt Total script time: 3.94 mins Published |
Thank you! /botio-linux makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/3d2676d61a9df20/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/3d2676d61a9df20/output.txt Total script time: 23.98 mins
|
A pdf with several pages containing some text or checked radio/checkbox not on page 1/2 were not printed.
Since they were not rendered in annotation_layer, then the annotationStorage has no entries for such widget.
So the goal of the patch is to fix that in using normalAppearance when the annotationStorage doesn't contain the widget id.