[JS] Embedded JS scripts can have some null chars

This commit is contained in:
Calixte Denizet 2022-07-15 14:59:29 +02:00
parent 3256761ead
commit 5f0c95e70e
2 changed files with 3 additions and 2 deletions

View File

@ -982,7 +982,8 @@ class Catalog {
if (javaScript === null) { if (javaScript === null) {
javaScript = new Map(); javaScript = new Map();
} }
javaScript.set(name, stringToPDFString(js)); js = stringToPDFString(js).replace(/\u0000/g, "");
javaScript.set(name, js);
} }
if (obj instanceof Dict && obj.has("JavaScript")) { if (obj instanceof Dict && obj.has("JavaScript")) {

View File

@ -339,7 +339,7 @@ function _collectJS(entry, xref, list, parents) {
} else if (typeof js === "string") { } else if (typeof js === "string") {
code = js; code = js;
} }
code = code && stringToPDFString(code); code = code && stringToPDFString(code).replace(/\u0000/g, "");
if (code) { if (code) {
list.push(code); list.push(code);
} }