mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-24 00:45:49 +02:00
Merge pull request #21431 from Snuffleupagus/more-isDict
Use the `isDict` helper function in a few more places
This commit is contained in:
commit
5873e1cbc0
@ -27,7 +27,15 @@ import {
|
|||||||
getNewAnnotationsMap,
|
getNewAnnotationsMap,
|
||||||
numberToString,
|
numberToString,
|
||||||
} from "../core_utils.js";
|
} from "../core_utils.js";
|
||||||
import { Dict, isName, Name, Ref, RefSet, RefSetCache } from "../primitives.js";
|
import {
|
||||||
|
Dict,
|
||||||
|
isDict,
|
||||||
|
isName,
|
||||||
|
Name,
|
||||||
|
Ref,
|
||||||
|
RefSet,
|
||||||
|
RefSetCache,
|
||||||
|
} from "../primitives.js";
|
||||||
import { incrementalUpdate, writeValue } from "../writer.js";
|
import { incrementalUpdate, writeValue } from "../writer.js";
|
||||||
import { isArrayEqual, stringToBytes } from "../../shared/util.js";
|
import { isArrayEqual, stringToBytes } from "../../shared/util.js";
|
||||||
import { NameTree, NumberTree } from "../name_number_tree.js";
|
import { NameTree, NumberTree } from "../name_number_tree.js";
|
||||||
@ -280,11 +288,7 @@ class PDFEditor {
|
|||||||
oldRefMapping.put(oldRef, newRef);
|
oldRefMapping.put(oldRef, newRef);
|
||||||
|
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||||
if (
|
if (isDict(obj, "Page") && !this.currentDocument.pagesMap.has(oldRef)) {
|
||||||
obj instanceof Dict &&
|
|
||||||
isName(obj.get("Type"), "Page") &&
|
|
||||||
!this.currentDocument.pagesMap.has(oldRef)
|
|
||||||
) {
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Add a deleted page to the document is not supported."
|
"Add a deleted page to the document is not supported."
|
||||||
);
|
);
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import {
|
|||||||
stringToUTF8String,
|
stringToUTF8String,
|
||||||
warn,
|
warn,
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
import { Dict, isName, Name, Ref, RefSetCache } from "./primitives.js";
|
import { Dict, isDict, isName, Name, Ref, RefSetCache } from "./primitives.js";
|
||||||
import { stringToAsciiOrUTF16BE, stringToPDFString } from "./string_utils.js";
|
import { stringToAsciiOrUTF16BE, stringToPDFString } from "./string_utils.js";
|
||||||
import { BaseStream } from "./base_stream.js";
|
import { BaseStream } from "./base_stream.js";
|
||||||
import { lookupNormalRect } from "./core_utils.js";
|
import { lookupNormalRect } from "./core_utils.js";
|
||||||
@ -594,10 +594,7 @@ class StructElementNode {
|
|||||||
}
|
}
|
||||||
for (let af of AFs) {
|
for (let af of AFs) {
|
||||||
af = this.xref.fetchIfRef(af);
|
af = this.xref.fetchIfRef(af);
|
||||||
if (!(af instanceof Dict)) {
|
if (!isDict(af, "Filespec")) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!isName(af.get("Type"), "Filespec")) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!isName(af.get("AFRelationship"), "Supplement")) {
|
if (!isName(af.get("AFRelationship"), "Supplement")) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user