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