mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-03 12:57: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() {
|
get _xfaStreams() {
|
||||||
const { acroForm } = this.catalog;
|
const acroForm = this.catalog.acroForm;
|
||||||
if (!acroForm) {
|
if (!acroForm) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const xfa = acroForm.get("XFA");
|
const xfa = acroForm.get("XFA");
|
||||||
const entries = new Map(
|
const entries = {
|
||||||
[
|
"xdp:xdp": "",
|
||||||
"xdp:xdp",
|
template: "",
|
||||||
"template",
|
datasets: "",
|
||||||
"datasets",
|
config: "",
|
||||||
"config",
|
connectionSet: "",
|
||||||
"connectionSet",
|
localeSet: "",
|
||||||
"localeSet",
|
stylesheet: "",
|
||||||
"stylesheet",
|
"/xdp:xdp": "",
|
||||||
"/xdp:xdp",
|
};
|
||||||
].map(e => [e, null])
|
|
||||||
);
|
|
||||||
if (xfa instanceof BaseStream && !xfa.isEmpty) {
|
if (xfa instanceof BaseStream && !xfa.isEmpty) {
|
||||||
entries.set("xdp:xdp", xfa);
|
entries["xdp:xdp"] = xfa;
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1154,14 +1152,14 @@ class PDFDocument {
|
|||||||
name = xfa[i];
|
name = xfa[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entries.has(name)) {
|
if (!entries.hasOwnProperty(name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const data = this.xref.fetchIfRef(xfa[i + 1]);
|
const data = this.xref.fetchIfRef(xfa[i + 1]);
|
||||||
if (!(data instanceof BaseStream) || data.isEmpty) {
|
if (!(data instanceof BaseStream) || data.isEmpty) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
entries.set(name, data);
|
entries[name] = data;
|
||||||
}
|
}
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
@ -1172,7 +1170,7 @@ class PDFDocument {
|
|||||||
return shadow(this, "xfaDatasets", null);
|
return shadow(this, "xfaDatasets", null);
|
||||||
}
|
}
|
||||||
for (const key of ["datasets", "xdp:xdp"]) {
|
for (const key of ["datasets", "xdp:xdp"]) {
|
||||||
const stream = streams.get(key);
|
const stream = streams[key];
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1194,7 +1192,7 @@ class PDFDocument {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const data = Object.create(null);
|
const data = Object.create(null);
|
||||||
for (const [key, stream] of streams) {
|
for (const [key, stream] of Object.entries(streams)) {
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -466,8 +466,8 @@ async function getFirstSerialized(page, filter = undefined) {
|
|||||||
function getAnnotationStorage(page) {
|
function getAnnotationStorage(page) {
|
||||||
return page.evaluate(() =>
|
return page.evaluate(() =>
|
||||||
Object.fromEntries(
|
Object.fromEntries(
|
||||||
window.PDFViewerApplication.pdfDocument.annotationStorage.serializable
|
window.PDFViewerApplication.pdfDocument.annotationStorage.serializable.map?.entries() ||
|
||||||
.map || []
|
[]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class SignatureStorage {
|
|||||||
#save() {
|
#save() {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
KEY_STORAGE,
|
KEY_STORAGE,
|
||||||
JSON.stringify(Object.fromEntries(this.#signatures))
|
JSON.stringify(Object.fromEntries(this.#signatures.entries()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user