mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Catch, and ignore, errors during Page.prototype.getStructTree
This way any errors thrown during parsing of the page-structTree will not be forwarded to the viewer.
This commit is contained in:
parent
2f7d163dfd
commit
76f23ce3b5
1 changed files with 12 additions and 4 deletions
|
@ -707,10 +707,18 @@ class Page {
|
|||
// Ensure that the structTree will contain the page's annotations.
|
||||
await this._parsedAnnotations;
|
||||
|
||||
const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [
|
||||
structTreeRoot,
|
||||
]);
|
||||
return this.pdfManager.ensure(structTree, "serializable");
|
||||
try {
|
||||
const structTree = await this.pdfManager.ensure(
|
||||
this,
|
||||
"_parseStructTree",
|
||||
[structTreeRoot]
|
||||
);
|
||||
const data = await this.pdfManager.ensure(structTree, "serializable");
|
||||
return data;
|
||||
} catch (ex) {
|
||||
warn(`getStructTree: "${ex}".`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue