mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Gracefully handle annotation parsing errors in Page.getOperatorList
(issue 11871)
This should ensure that a page will always render successfully, even if there's errors during the Annotation fetching/parsing. Additionally the `OperatorList.addOpList` method is also adjusted to ignore invalid data, to make it slightly more robust.
This commit is contained in:
parent
2711f4bc8c
commit
4aabd063fc
4 changed files with 24 additions and 6 deletions
|
@ -302,11 +302,15 @@ class Page {
|
|||
for (const annotation of annotations) {
|
||||
if (isAnnotationRenderable(annotation, intent)) {
|
||||
opListPromises.push(
|
||||
annotation.getOperatorList(
|
||||
partialEvaluator,
|
||||
task,
|
||||
renderInteractiveForms
|
||||
)
|
||||
annotation
|
||||
.getOperatorList(partialEvaluator, task, renderInteractiveForms)
|
||||
.catch(function (reason) {
|
||||
warn(
|
||||
"getOperatorList - ignoring annotation data during " +
|
||||
`"${task.name}" task: "${reason}".`
|
||||
);
|
||||
return null;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue