-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Extract Lang attribute for marked contents #20407
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
base: master
Are you sure you want to change the base?
Conversation
test/unit/api_spec.js
Outdated
| const pdfDoc = await loadingTask.promise; | ||
| const pdfPage = await pdfDoc.getPage(1); | ||
|
|
||
| pdfDoc.annotationStorage.setValue("30R", { value: "test" }); |
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.
There is no annotations in the pdf so I don't see the point of setting these 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.
Uh I am sorry, bad copy/paste from a previous test. Removed
| const opList = await pdfPage.getOperatorList({ | ||
| annotationMode: AnnotationMode.DISABLE, | ||
| }); | ||
| expect(opList.fnArray[0]).toEqual(OPS.beginMarkedContentProps); |
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.
Why is it useful to get the lang parameter in the operator list which is used to draw the pdf ?
| props.lang = stringToPDFString(lang); | ||
| } | ||
| } | ||
|
|
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.
As said in the test, I don't understand why it's useful.
That said, I don't really see the point of having the MCID neither...
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.
IMHO, it's correct for an API called getOperatorList to return the complete list of operators and their arguments, as well as the MCID. It's then up to the rendering scripts to decide whether or not to use that data.
Some marked contents have a
Langattribute defined in the props passed to thebeginMarkedContentPropsoperator. With this PR, the evaluator extracts this information. I chose to pass thepropsobject as third argument in order to maintain backwards compatibility, but I'm open to changes.