mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-29 18:37:20 +02:00
Compare commits
No commits in common. "5da507f279b535e44254d05976c2a8ce881f4380" and "9c6e2e6df0f43acb5ae9d72208ba0f09f7f55d68" have entirely different histories.
5da507f279
...
9c6e2e6df0
@ -1117,26 +1117,24 @@ class PDFDocument {
|
||||
}
|
||||
|
||||
get _xfaStreams() {
|
||||
const { acroForm } = this.catalog;
|
||||
const acroForm = this.catalog.acroForm;
|
||||
if (!acroForm) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const xfa = acroForm.get("XFA");
|
||||
const entries = new Map(
|
||||
[
|
||||
"xdp:xdp",
|
||||
"template",
|
||||
"datasets",
|
||||
"config",
|
||||
"connectionSet",
|
||||
"localeSet",
|
||||
"stylesheet",
|
||||
"/xdp:xdp",
|
||||
].map(e => [e, null])
|
||||
);
|
||||
const entries = {
|
||||
"xdp:xdp": "",
|
||||
template: "",
|
||||
datasets: "",
|
||||
config: "",
|
||||
connectionSet: "",
|
||||
localeSet: "",
|
||||
stylesheet: "",
|
||||
"/xdp:xdp": "",
|
||||
};
|
||||
if (xfa instanceof BaseStream && !xfa.isEmpty) {
|
||||
entries.set("xdp:xdp", xfa);
|
||||
entries["xdp:xdp"] = xfa;
|
||||
return entries;
|
||||
}
|
||||
|
||||
@ -1154,14 +1152,14 @@ class PDFDocument {
|
||||
name = xfa[i];
|
||||
}
|
||||
|
||||
if (!entries.has(name)) {
|
||||
if (!entries.hasOwnProperty(name)) {
|
||||
continue;
|
||||
}
|
||||
const data = this.xref.fetchIfRef(xfa[i + 1]);
|
||||
if (!(data instanceof BaseStream) || data.isEmpty) {
|
||||
continue;
|
||||
}
|
||||
entries.set(name, data);
|
||||
entries[name] = data;
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
@ -1172,7 +1170,7 @@ class PDFDocument {
|
||||
return shadow(this, "xfaDatasets", null);
|
||||
}
|
||||
for (const key of ["datasets", "xdp:xdp"]) {
|
||||
const stream = streams.get(key);
|
||||
const stream = streams[key];
|
||||
if (!stream) {
|
||||
continue;
|
||||
}
|
||||
@ -1194,7 +1192,7 @@ class PDFDocument {
|
||||
return null;
|
||||
}
|
||||
const data = Object.create(null);
|
||||
for (const [key, stream] of streams) {
|
||||
for (const [key, stream] of Object.entries(streams)) {
|
||||
if (!stream) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -466,8 +466,8 @@ async function getFirstSerialized(page, filter = undefined) {
|
||||
function getAnnotationStorage(page) {
|
||||
return page.evaluate(() =>
|
||||
Object.fromEntries(
|
||||
window.PDFViewerApplication.pdfDocument.annotationStorage.serializable
|
||||
.map || []
|
||||
window.PDFViewerApplication.pdfDocument.annotationStorage.serializable.map?.entries() ||
|
||||
[]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ class SignatureStorage {
|
||||
#save() {
|
||||
localStorage.setItem(
|
||||
KEY_STORAGE,
|
||||
JSON.stringify(Object.fromEntries(this.#signatures))
|
||||
JSON.stringify(Object.fromEntries(this.#signatures.entries()))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user