mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-03 12:57:20 +02:00
Compare commits
6 Commits
9c6e2e6df0
...
5da507f279
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5da507f279 | ||
|
|
5f3e8806fe | ||
|
|
f482232493 | ||
|
|
1c80412f61 | ||
|
|
60bf9b133a | ||
|
|
1d1e6e7b92 |
@ -1117,24 +1117,26 @@ class PDFDocument {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get _xfaStreams() {
|
get _xfaStreams() {
|
||||||
const acroForm = this.catalog.acroForm;
|
const { acroForm } = this.catalog;
|
||||||
if (!acroForm) {
|
if (!acroForm) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const xfa = acroForm.get("XFA");
|
const xfa = acroForm.get("XFA");
|
||||||
const entries = {
|
const entries = new Map(
|
||||||
"xdp:xdp": "",
|
[
|
||||||
template: "",
|
"xdp:xdp",
|
||||||
datasets: "",
|
"template",
|
||||||
config: "",
|
"datasets",
|
||||||
connectionSet: "",
|
"config",
|
||||||
localeSet: "",
|
"connectionSet",
|
||||||
stylesheet: "",
|
"localeSet",
|
||||||
"/xdp:xdp": "",
|
"stylesheet",
|
||||||
};
|
"/xdp:xdp",
|
||||||
|
].map(e => [e, null])
|
||||||
|
);
|
||||||
if (xfa instanceof BaseStream && !xfa.isEmpty) {
|
if (xfa instanceof BaseStream && !xfa.isEmpty) {
|
||||||
entries["xdp:xdp"] = xfa;
|
entries.set("xdp:xdp", xfa);
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1152,14 +1154,14 @@ class PDFDocument {
|
|||||||
name = xfa[i];
|
name = xfa[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entries.hasOwnProperty(name)) {
|
if (!entries.has(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[name] = data;
|
entries.set(name, data);
|
||||||
}
|
}
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
@ -1170,7 +1172,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[key];
|
const stream = streams.get(key);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1192,7 +1194,7 @@ class PDFDocument {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const data = Object.create(null);
|
const data = Object.create(null);
|
||||||
for (const [key, stream] of Object.entries(streams)) {
|
for (const [key, stream] of 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.map?.entries() ||
|
window.PDFViewerApplication.pdfDocument.annotationStorage.serializable
|
||||||
[]
|
.map || []
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class SignatureStorage {
|
|||||||
#save() {
|
#save() {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
KEY_STORAGE,
|
KEY_STORAGE,
|
||||||
JSON.stringify(Object.fromEntries(this.#signatures.entries()))
|
JSON.stringify(Object.fromEntries(this.#signatures))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user