-
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
Add support for callout arrow in FreeTextAnnotation #19380
base: master
Are you sure you want to change the base?
Add support for callout arrow in FreeTextAnnotation #19380
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.
Thanks for the patch, however given that this adds basically unused code it's not entirely clear (at least) to me that we should add this.[1]
Also, even if we'd accept this feature it'd definitely require unit-tests.
[1] The fact that we added lineEndings
previously always felt like a mistake, since we've never used that code.
* Set the line ending; should only be used with FreeText annotations. | ||
* @param {Name} lineEnding - The line ending name. | ||
*/ | ||
setLineEnding(lineEnding) { |
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.
Please don't add an almost duplicate of an existing method, since both cases should use rather one common helper to reduce code-size.
src/core/annotation.js
Outdated
this.data.calloutLine = dict.getArray("CL"); | ||
this.data.rectDifference = dict.getArray("RD"); |
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.
In a corrupt PDF document those fields can contain anything and obviously need to be properly parsed and validated, rather than included as-is since that could lead to failures.
Thanks @Snuffleupagus for the review! I'll try to reply to your concerns before going back to the code.
At the moment, the core annotation editor of PDF.js allows to edit I also think is valuable that annotation models are as accurate as possible, since they can be accessed and inspected using I haven't looked into PDF.js unit testing yet, but I'd be happy to extend the PR if there's a chance it'll get accepted. |
c2a52bc
to
e2bb200
Compare
Hello @Snuffleupagus, I added some validation when reading values from the dictionary and added a couple of unit tests. |
|
If it can help with the judgment, these are the other two PRs I would like to open (they lack review and unit tests, but I'll think about it after solving this one): |
This PR adds callout information to the
FreeTextAnnotation
model.This data are required to extend the editor support for this kind of annotations.