-
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
[api-minor] Convert PDFObjects
, in src/display/api.js
, to an ES6 class
#10233
Conversation
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/5425b5e437f7c96/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/ee0d50a8914a607/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/5425b5e437f7c96/output.txt Total script time: 19.29 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/ee0d50a8914a607/output.txt Total script time: 24.97 mins
|
5e4912c
to
06be4f8
Compare
src/display/annotation_layer.js
Outdated
@@ -448,7 +448,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { | |||
|
|||
let font = null; | |||
if (this.data.fontRefName) { | |||
font = this.page.commonObjs.getData(this.data.fontRefName); | |||
font = this.page.commonObjs.getSafely(this.data.fontRefName); |
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 think we can get rid of getSafely
altogether if we remove this font code since, as far as I could tell, this.data.fontRefName
is never actually set (one of the open points from #7613 that has been bothering me a bit). If we decide to implement font support later on, we can probably just use the regular get
method with a try-catch block if necessary. What do you think?
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.
While I totally agree that this code looks quite weird, I'd nonetheless prefer to not start making larger annotationLayer changes here since that feels like scope creep.
However, I'm not entirely happy about needing the getSafely
method, so I'll change this to a combination of PDFObjects.{has, get}
here instead to minimize the size of the patch.
Also changes all occurrences of `var` to `const`, and marks internal properties/methods as "private".
First of all, note how there's currently *two* methods for checking if a certain object exists, which seems completely unwarranted. Furthermore, the rarely used `getData` method was removed and its only callsite changed to use a combination of `PDFObjects.{has, get}` instead. Finally, the methods were rearranged slightly, to bring the most important ones (for an API user) to the top of the class.
06be4f8
to
60da2d8
Compare
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/09d62e7efd43910/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/d14048382b67370/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/d14048382b67370/output.txt Total script time: 19.37 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/09d62e7efd43910/output.txt Total script time: 24.46 mins
|
Thank you for simplifying this! |
No description provided.