Merge pull request #15880 from Snuffleupagus/rm-docStats
[api-minor] Remove the `PDFDocumentProxy.stats` getter (PR 15758 follow-up)
This commit is contained in:
commit
42aa08563b
@ -17,9 +17,7 @@ import {
|
|||||||
AnnotationEditorPrefix,
|
AnnotationEditorPrefix,
|
||||||
assert,
|
assert,
|
||||||
BaseException,
|
BaseException,
|
||||||
FontType,
|
|
||||||
objectSize,
|
objectSize,
|
||||||
StreamType,
|
|
||||||
stringToPDFString,
|
stringToPDFString,
|
||||||
warn,
|
warn,
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
@ -82,55 +80,6 @@ class XRefParseException extends BaseException {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DocStats {
|
|
||||||
constructor(handler) {
|
|
||||||
this._handler = handler;
|
|
||||||
|
|
||||||
this._streamTypes = new Set();
|
|
||||||
this._fontTypes = new Set();
|
|
||||||
}
|
|
||||||
|
|
||||||
_send() {
|
|
||||||
const streamTypes = Object.create(null),
|
|
||||||
fontTypes = Object.create(null);
|
|
||||||
for (const type of this._streamTypes) {
|
|
||||||
streamTypes[type] = true;
|
|
||||||
}
|
|
||||||
for (const type of this._fontTypes) {
|
|
||||||
fontTypes[type] = true;
|
|
||||||
}
|
|
||||||
this._handler.send("DocStats", { streamTypes, fontTypes });
|
|
||||||
}
|
|
||||||
|
|
||||||
addStreamType(type) {
|
|
||||||
if (
|
|
||||||
typeof PDFJSDev === "undefined" ||
|
|
||||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
|
||||||
) {
|
|
||||||
assert(StreamType[type] === type, 'addStreamType: Invalid "type" value.');
|
|
||||||
}
|
|
||||||
if (this._streamTypes.has(type)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._streamTypes.add(type);
|
|
||||||
this._send();
|
|
||||||
}
|
|
||||||
|
|
||||||
addFontType(type) {
|
|
||||||
if (
|
|
||||||
typeof PDFJSDev === "undefined" ||
|
|
||||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
|
||||||
) {
|
|
||||||
assert(FontType[type] === type, 'addFontType: Invalid "type" value.');
|
|
||||||
}
|
|
||||||
if (this._fontTypes.has(type)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._fontTypes.add(type);
|
|
||||||
this._send();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value of an inheritable property.
|
* Get the value of an inheritable property.
|
||||||
*
|
*
|
||||||
@ -631,7 +580,6 @@ function getRotationMatrix(rotation, width, height) {
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
collectActions,
|
collectActions,
|
||||||
DocStats,
|
|
||||||
encodeToXmlString,
|
encodeToXmlString,
|
||||||
escapePDFName,
|
escapePDFName,
|
||||||
escapeString,
|
escapeString,
|
||||||
|
@ -222,11 +222,13 @@ class Page {
|
|||||||
*/
|
*/
|
||||||
_onSubStreamError(handler, reason, objId) {
|
_onSubStreamError(handler, reason, objId) {
|
||||||
if (this.evaluatorOptions.ignoreErrors) {
|
if (this.evaluatorOptions.ignoreErrors) {
|
||||||
// Error(s) when reading one of the /Contents sub-streams -- sending
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
// unsupported feature notification and allow parsing to continue.
|
// Error(s) when reading one of the /Contents sub-streams -- sending
|
||||||
handler.send("UnsupportedFeature", {
|
// unsupported feature notification and allow parsing to continue.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorContentSubStream,
|
handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorContentSubStream,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
|
warn(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ import {
|
|||||||
import { CMapFactory, IdentityCMap } from "./cmap.js";
|
import { CMapFactory, IdentityCMap } from "./cmap.js";
|
||||||
import { Cmd, Dict, EOF, isName, Name, Ref, RefSet } from "./primitives.js";
|
import { Cmd, Dict, EOF, isName, Name, Ref, RefSet } from "./primitives.js";
|
||||||
import { ErrorFont, Font } from "./fonts.js";
|
import { ErrorFont, Font } from "./fonts.js";
|
||||||
import { FontFlags, getFontType } from "./fonts_utils.js";
|
|
||||||
import {
|
import {
|
||||||
getEncoding,
|
getEncoding,
|
||||||
MacRomanEncoding,
|
MacRomanEncoding,
|
||||||
@ -67,6 +66,7 @@ import { BaseStream } from "./base_stream.js";
|
|||||||
import { bidi } from "./bidi.js";
|
import { bidi } from "./bidi.js";
|
||||||
import { ColorSpace } from "./colorspace.js";
|
import { ColorSpace } from "./colorspace.js";
|
||||||
import { DecodeStream } from "./decode_stream.js";
|
import { DecodeStream } from "./decode_stream.js";
|
||||||
|
import { FontFlags } from "./fonts_utils.js";
|
||||||
import { getGlyphsUnicode } from "./glyphlist.js";
|
import { getGlyphsUnicode } from "./glyphlist.js";
|
||||||
import { getLookupTableFactory } from "./core_utils.js";
|
import { getLookupTableFactory } from "./core_utils.js";
|
||||||
import { getMetrics } from "./metrics.js";
|
import { getMetrics } from "./metrics.js";
|
||||||
@ -929,11 +929,13 @@ class PartialEvaluator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.options.ignoreErrors) {
|
if (this.options.ignoreErrors) {
|
||||||
// Error(s) in the TilingPattern -- sending unsupported feature
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
// notification and allow rendering to continue.
|
// Error(s) in the TilingPattern -- sending unsupported feature
|
||||||
this.handler.send("UnsupportedFeature", {
|
// notification and allow rendering to continue.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorTilingPattern,
|
this.handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorTilingPattern,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`handleTilingType - ignoring pattern: "${reason}".`);
|
warn(`handleTilingType - ignoring pattern: "${reason}".`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -975,11 +977,13 @@ class PartialEvaluator {
|
|||||||
return translated;
|
return translated;
|
||||||
})
|
})
|
||||||
.catch(reason => {
|
.catch(reason => {
|
||||||
// Error in the font data -- sending unsupported feature
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
// notification.
|
// Error in the font data -- sending unsupported feature
|
||||||
this.handler.send("UnsupportedFeature", {
|
// notification.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorFontLoadType3,
|
this.handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorFontLoadType3,
|
||||||
|
});
|
||||||
|
}
|
||||||
return new TranslatedFont({
|
return new TranslatedFont({
|
||||||
loadedName: "g_font_error",
|
loadedName: "g_font_error",
|
||||||
font: new ErrorFont(`Type3 font load error: ${reason}`),
|
font: new ErrorFont(`Type3 font load error: ${reason}`),
|
||||||
@ -1029,11 +1033,13 @@ class PartialEvaluator {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (this.options.ignoreErrors) {
|
if (this.options.ignoreErrors) {
|
||||||
// Missing setFont operator before text rendering operator -- sending
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
// unsupported feature notification and allow rendering to continue.
|
// Missing setFont operator before text rendering operator -- sending
|
||||||
this.handler.send("UnsupportedFeature", {
|
// unsupported feature notification and allow rendering to continue.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorFontState,
|
this.handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorFontState,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`ensureStateFont: "${reason}".`);
|
warn(`ensureStateFont: "${reason}".`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1191,10 +1197,12 @@ class PartialEvaluator {
|
|||||||
warn(`${partialMsg}.`);
|
warn(`${partialMsg}.`);
|
||||||
return errorFont();
|
return errorFont();
|
||||||
}
|
}
|
||||||
// Font not found -- sending unsupported feature notification.
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
this.handler.send("UnsupportedFeature", {
|
// Font not found -- sending unsupported feature notification.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorFontMissing,
|
this.handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorFontMissing,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`${partialMsg} -- attempting to fallback to a default font.`);
|
warn(`${partialMsg} -- attempting to fallback to a default font.`);
|
||||||
|
|
||||||
// Falling back to a default font to avoid completely broken rendering,
|
// Falling back to a default font to avoid completely broken rendering,
|
||||||
@ -1302,10 +1310,6 @@ class PartialEvaluator {
|
|||||||
|
|
||||||
this.translateFont(preEvaluatedFont)
|
this.translateFont(preEvaluatedFont)
|
||||||
.then(translatedFont => {
|
.then(translatedFont => {
|
||||||
if (translatedFont.fontType !== undefined) {
|
|
||||||
xref.stats.addFontType(translatedFont.fontType);
|
|
||||||
}
|
|
||||||
|
|
||||||
fontCapability.resolve(
|
fontCapability.resolve(
|
||||||
new TranslatedFont({
|
new TranslatedFont({
|
||||||
loadedName: font.loadedName,
|
loadedName: font.loadedName,
|
||||||
@ -1317,25 +1321,14 @@ class PartialEvaluator {
|
|||||||
})
|
})
|
||||||
.catch(reason => {
|
.catch(reason => {
|
||||||
// TODO fontCapability.reject?
|
// TODO fontCapability.reject?
|
||||||
// Error in the font data -- sending unsupported feature notification.
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
this.handler.send("UnsupportedFeature", {
|
// Error in the font data -- sending unsupported feature notification.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorFontTranslate,
|
this.handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorFontTranslate,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`loadFont - translateFont failed: "${reason}".`);
|
warn(`loadFont - translateFont failed: "${reason}".`);
|
||||||
|
|
||||||
try {
|
|
||||||
// error, but it's still nice to have font type reported
|
|
||||||
const fontFile3 = descriptor && descriptor.get("FontFile3");
|
|
||||||
const subtype = fontFile3 && fontFile3.get("Subtype");
|
|
||||||
const fontType = getFontType(
|
|
||||||
preEvaluatedFont.type,
|
|
||||||
subtype && subtype.name
|
|
||||||
);
|
|
||||||
if (fontType !== undefined) {
|
|
||||||
xref.stats.addFontType(fontType);
|
|
||||||
}
|
|
||||||
} catch (ex) {}
|
|
||||||
|
|
||||||
fontCapability.resolve(
|
fontCapability.resolve(
|
||||||
new TranslatedFont({
|
new TranslatedFont({
|
||||||
loadedName: font.loadedName,
|
loadedName: font.loadedName,
|
||||||
@ -1439,11 +1432,13 @@ class PartialEvaluator {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (this.options.ignoreErrors) {
|
if (this.options.ignoreErrors) {
|
||||||
// Error(s) in the ColorSpace -- sending unsupported feature
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
// notification and allow rendering to continue.
|
// Error(s) in the ColorSpace -- sending unsupported feature
|
||||||
this.handler.send("UnsupportedFeature", {
|
// notification and allow rendering to continue.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorColorSpace,
|
this.handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorColorSpace,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
|
warn(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1828,11 +1823,16 @@ class PartialEvaluator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (self.options.ignoreErrors) {
|
if (self.options.ignoreErrors) {
|
||||||
// Error(s) in the XObject -- sending unsupported feature
|
if (
|
||||||
// notification and allow rendering to continue.
|
typeof PDFJSDev === "undefined" ||
|
||||||
self.handler.send("UnsupportedFeature", {
|
PDFJSDev.test("GENERIC")
|
||||||
featureId: UNSUPPORTED_FEATURES.errorXObject,
|
) {
|
||||||
});
|
// Error(s) in the XObject -- sending unsupported feature
|
||||||
|
// notification and allow rendering to continue.
|
||||||
|
self.handler.send("UnsupportedFeature", {
|
||||||
|
featureId: UNSUPPORTED_FEATURES.errorXObject,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`getOperatorList - ignoring XObject: "${reason}".`);
|
warn(`getOperatorList - ignoring XObject: "${reason}".`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2147,11 +2147,16 @@ class PartialEvaluator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (self.options.ignoreErrors) {
|
if (self.options.ignoreErrors) {
|
||||||
// Error(s) in the ExtGState -- sending unsupported feature
|
if (
|
||||||
// notification and allow parsing/rendering to continue.
|
typeof PDFJSDev === "undefined" ||
|
||||||
self.handler.send("UnsupportedFeature", {
|
PDFJSDev.test("GENERIC")
|
||||||
featureId: UNSUPPORTED_FEATURES.errorExtGState,
|
) {
|
||||||
});
|
// Error(s) in the ExtGState -- sending unsupported feature
|
||||||
|
// notification and allow parsing/rendering to continue.
|
||||||
|
self.handler.send("UnsupportedFeature", {
|
||||||
|
featureId: UNSUPPORTED_FEATURES.errorExtGState,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`getOperatorList - ignoring ExtGState: "${reason}".`);
|
warn(`getOperatorList - ignoring ExtGState: "${reason}".`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2199,9 +2204,14 @@ class PartialEvaluator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (self.options.ignoreErrors) {
|
if (self.options.ignoreErrors) {
|
||||||
self.handler.send("UnsupportedFeature", {
|
if (
|
||||||
featureId: UNSUPPORTED_FEATURES.errorMarkedContent,
|
typeof PDFJSDev === "undefined" ||
|
||||||
});
|
PDFJSDev.test("GENERIC")
|
||||||
|
) {
|
||||||
|
self.handler.send("UnsupportedFeature", {
|
||||||
|
featureId: UNSUPPORTED_FEATURES.errorMarkedContent,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(
|
warn(
|
||||||
`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`
|
`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`
|
||||||
);
|
);
|
||||||
@ -2252,11 +2262,13 @@ class PartialEvaluator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.options.ignoreErrors) {
|
if (this.options.ignoreErrors) {
|
||||||
// Error(s) in the OperatorList -- sending unsupported feature
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
// notification and allow rendering to continue.
|
// Error(s) in the OperatorList -- sending unsupported feature
|
||||||
this.handler.send("UnsupportedFeature", {
|
// notification and allow rendering to continue.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorOperatorList,
|
this.handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorOperatorList,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(
|
warn(
|
||||||
`getOperatorList - ignoring errors during "${task.name}" ` +
|
`getOperatorList - ignoring errors during "${task.name}" ` +
|
||||||
`task: "${reason}".`
|
`task: "${reason}".`
|
||||||
@ -3751,11 +3763,13 @@ class PartialEvaluator {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (this.options.ignoreErrors) {
|
if (this.options.ignoreErrors) {
|
||||||
// Error in the ToUnicode data -- sending unsupported feature
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
// notification and allow font parsing to continue.
|
// Error in the ToUnicode data -- sending unsupported feature
|
||||||
this.handler.send("UnsupportedFeature", {
|
// notification and allow font parsing to continue.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorFontToUnicode,
|
this.handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorFontToUnicode,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
|
warn(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -4329,11 +4343,13 @@ class PartialEvaluator {
|
|||||||
]);
|
]);
|
||||||
} catch (reason) {
|
} catch (reason) {
|
||||||
if (evaluatorOptions.ignoreErrors) {
|
if (evaluatorOptions.ignoreErrors) {
|
||||||
// Error in the font data -- sending unsupported feature notification
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
// and allow glyph path building to continue.
|
// Error in the font data -- sending unsupported feature
|
||||||
handler.send("UnsupportedFeature", {
|
// notification and allow glyph path building to continue.
|
||||||
featureId: UNSUPPORTED_FEATURES.errorFontBuildPath,
|
handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorFontBuildPath,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
|
warn(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ import {
|
|||||||
assert,
|
assert,
|
||||||
bytesToString,
|
bytesToString,
|
||||||
FONT_IDENTITY_MATRIX,
|
FONT_IDENTITY_MATRIX,
|
||||||
FontType,
|
|
||||||
FormatError,
|
FormatError,
|
||||||
info,
|
info,
|
||||||
shadow,
|
shadow,
|
||||||
@ -27,7 +26,6 @@ import {
|
|||||||
import { CFFCompiler, CFFParser } from "./cff_parser.js";
|
import { CFFCompiler, CFFParser } from "./cff_parser.js";
|
||||||
import {
|
import {
|
||||||
FontFlags,
|
FontFlags,
|
||||||
getFontType,
|
|
||||||
MacStandardGlyphOrdering,
|
MacStandardGlyphOrdering,
|
||||||
normalizeFontName,
|
normalizeFontName,
|
||||||
recoverGlyphName,
|
recoverGlyphName,
|
||||||
@ -92,7 +90,6 @@ const EXPORT_DATA_PROPERTIES = [
|
|||||||
"descent",
|
"descent",
|
||||||
"fallbackName",
|
"fallbackName",
|
||||||
"fontMatrix",
|
"fontMatrix",
|
||||||
"fontType",
|
|
||||||
"isInvalidPDFjsFont",
|
"isInvalidPDFjsFont",
|
||||||
"isType3Font",
|
"isType3Font",
|
||||||
"italic",
|
"italic",
|
||||||
@ -986,7 +983,6 @@ class Font {
|
|||||||
this.toFontChar[charCode] =
|
this.toFontChar[charCode] =
|
||||||
this.differences[charCode] || properties.defaultEncoding[charCode];
|
this.differences[charCode] || properties.defaultEncoding[charCode];
|
||||||
}
|
}
|
||||||
this.fontType = FontType.TYPE3;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,7 +1062,6 @@ class Font {
|
|||||||
|
|
||||||
amendFallbackToUnicode(properties);
|
amendFallbackToUnicode(properties);
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.fontType = getFontType(type, subtype, properties.isStandardFont);
|
|
||||||
|
|
||||||
// Transfer some properties again that could change during font conversion
|
// Transfer some properties again that could change during font conversion
|
||||||
this.fontMatrix = properties.fontMatrix;
|
this.fontMatrix = properties.fontMatrix;
|
||||||
@ -1102,9 +1097,7 @@ class Font {
|
|||||||
this.missingFile = true;
|
this.missingFile = true;
|
||||||
// The file data is not specified. Trying to fix the font name
|
// The file data is not specified. Trying to fix the font name
|
||||||
// to be used with the canvas.font.
|
// to be used with the canvas.font.
|
||||||
const name = this.name;
|
const { name, type } = this;
|
||||||
const type = this.type;
|
|
||||||
const subtype = this.subtype;
|
|
||||||
let fontName = normalizeFontName(name);
|
let fontName = normalizeFontName(name);
|
||||||
const stdFontMap = getStdFontMap(),
|
const stdFontMap = getStdFontMap(),
|
||||||
nonStdFontMap = getNonStdFontMap();
|
nonStdFontMap = getNonStdFontMap();
|
||||||
@ -1252,7 +1245,6 @@ class Font {
|
|||||||
|
|
||||||
amendFallbackToUnicode(properties);
|
amendFallbackToUnicode(properties);
|
||||||
this.loadedName = fontName.split("-")[0];
|
this.loadedName = fontName.split("-")[0];
|
||||||
this.fontType = getFontType(type, subtype, properties.isStandardFont);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAndRepair(name, font, properties) {
|
checkAndRepair(name, font, properties) {
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { FontType, info } from "../shared/util.js";
|
|
||||||
import { getEncoding, StandardEncoding } from "./encodings.js";
|
import { getEncoding, StandardEncoding } from "./encodings.js";
|
||||||
import { getGlyphsUnicode } from "./glyphlist.js";
|
import { getGlyphsUnicode } from "./glyphlist.js";
|
||||||
import { getUnicodeForGlyph } from "./unicode.js";
|
import { getUnicodeForGlyph } from "./unicode.js";
|
||||||
|
import { info } from "../shared/util.js";
|
||||||
|
|
||||||
// Accented characters have issues on Windows and Linux. When this flag is
|
// Accented characters have issues on Windows and Linux. When this flag is
|
||||||
// enabled glyphs that use seac and seac style endchar operators are truncated
|
// enabled glyphs that use seac and seac style endchar operators are truncated
|
||||||
@ -78,32 +78,6 @@ const MacStandardGlyphOrdering = [
|
|||||||
"threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla",
|
"threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla",
|
||||||
"scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
|
"scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
|
||||||
|
|
||||||
function getFontType(type, subtype, isStandardFont = false) {
|
|
||||||
switch (type) {
|
|
||||||
case "Type1":
|
|
||||||
if (isStandardFont) {
|
|
||||||
return FontType.TYPE1STANDARD;
|
|
||||||
}
|
|
||||||
return subtype === "Type1C" ? FontType.TYPE1C : FontType.TYPE1;
|
|
||||||
case "CIDFontType0":
|
|
||||||
return subtype === "CIDFontType0C"
|
|
||||||
? FontType.CIDFONTTYPE0C
|
|
||||||
: FontType.CIDFONTTYPE0;
|
|
||||||
case "OpenType":
|
|
||||||
return FontType.OPENTYPE;
|
|
||||||
case "TrueType":
|
|
||||||
return FontType.TRUETYPE;
|
|
||||||
case "CIDFontType2":
|
|
||||||
return FontType.CIDFONTTYPE2;
|
|
||||||
case "MMType1":
|
|
||||||
return FontType.MMTYPE1;
|
|
||||||
case "Type0":
|
|
||||||
return FontType.TYPE0;
|
|
||||||
default:
|
|
||||||
return FontType.UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some bad PDF generators, e.g. Scribus PDF, include glyph names
|
// Some bad PDF generators, e.g. Scribus PDF, include glyph names
|
||||||
// in a 'uniXXXX' format -- attempting to recover proper ones.
|
// in a 'uniXXXX' format -- attempting to recover proper ones.
|
||||||
function recoverGlyphName(name, glyphsUnicodeMap) {
|
function recoverGlyphName(name, glyphsUnicodeMap) {
|
||||||
@ -212,7 +186,6 @@ function normalizeFontName(name) {
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
FontFlags,
|
FontFlags,
|
||||||
getFontType,
|
|
||||||
MacStandardGlyphOrdering,
|
MacStandardGlyphOrdering,
|
||||||
normalizeFontName,
|
normalizeFontName,
|
||||||
recoverGlyphName,
|
recoverGlyphName,
|
||||||
|
@ -18,7 +18,6 @@ import {
|
|||||||
bytesToString,
|
bytesToString,
|
||||||
FormatError,
|
FormatError,
|
||||||
info,
|
info,
|
||||||
StreamType,
|
|
||||||
warn,
|
warn,
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
import { Cmd, Dict, EOF, isCmd, Name, Ref } from "./primitives.js";
|
import { Cmd, Dict, EOF, isCmd, Name, Ref } from "./primitives.js";
|
||||||
@ -732,13 +731,11 @@ class Parser {
|
|||||||
warn(`Empty "${name}" stream.`);
|
warn(`Empty "${name}" stream.`);
|
||||||
return new NullStream();
|
return new NullStream();
|
||||||
}
|
}
|
||||||
const xrefStats = this.xref.stats;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "Fl":
|
case "Fl":
|
||||||
case "FlateDecode":
|
case "FlateDecode":
|
||||||
xrefStats.addStreamType(StreamType.FLATE);
|
|
||||||
if (params) {
|
if (params) {
|
||||||
return new PredictorStream(
|
return new PredictorStream(
|
||||||
new FlateStream(stream, maybeLength),
|
new FlateStream(stream, maybeLength),
|
||||||
@ -749,7 +746,6 @@ class Parser {
|
|||||||
return new FlateStream(stream, maybeLength);
|
return new FlateStream(stream, maybeLength);
|
||||||
case "LZW":
|
case "LZW":
|
||||||
case "LZWDecode":
|
case "LZWDecode":
|
||||||
xrefStats.addStreamType(StreamType.LZW);
|
|
||||||
let earlyChange = 1;
|
let earlyChange = 1;
|
||||||
if (params) {
|
if (params) {
|
||||||
if (params.has("EarlyChange")) {
|
if (params.has("EarlyChange")) {
|
||||||
@ -764,30 +760,23 @@ class Parser {
|
|||||||
return new LZWStream(stream, maybeLength, earlyChange);
|
return new LZWStream(stream, maybeLength, earlyChange);
|
||||||
case "DCT":
|
case "DCT":
|
||||||
case "DCTDecode":
|
case "DCTDecode":
|
||||||
xrefStats.addStreamType(StreamType.DCT);
|
|
||||||
return new JpegStream(stream, maybeLength, params);
|
return new JpegStream(stream, maybeLength, params);
|
||||||
case "JPX":
|
case "JPX":
|
||||||
case "JPXDecode":
|
case "JPXDecode":
|
||||||
xrefStats.addStreamType(StreamType.JPX);
|
|
||||||
return new JpxStream(stream, maybeLength, params);
|
return new JpxStream(stream, maybeLength, params);
|
||||||
case "A85":
|
case "A85":
|
||||||
case "ASCII85Decode":
|
case "ASCII85Decode":
|
||||||
xrefStats.addStreamType(StreamType.A85);
|
|
||||||
return new Ascii85Stream(stream, maybeLength);
|
return new Ascii85Stream(stream, maybeLength);
|
||||||
case "AHx":
|
case "AHx":
|
||||||
case "ASCIIHexDecode":
|
case "ASCIIHexDecode":
|
||||||
xrefStats.addStreamType(StreamType.AHX);
|
|
||||||
return new AsciiHexStream(stream, maybeLength);
|
return new AsciiHexStream(stream, maybeLength);
|
||||||
case "CCF":
|
case "CCF":
|
||||||
case "CCITTFaxDecode":
|
case "CCITTFaxDecode":
|
||||||
xrefStats.addStreamType(StreamType.CCF);
|
|
||||||
return new CCITTFaxStream(stream, maybeLength, params);
|
return new CCITTFaxStream(stream, maybeLength, params);
|
||||||
case "RL":
|
case "RL":
|
||||||
case "RunLengthDecode":
|
case "RunLengthDecode":
|
||||||
xrefStats.addStreamType(StreamType.RLX);
|
|
||||||
return new RunLengthStream(stream, maybeLength);
|
return new RunLengthStream(stream, maybeLength);
|
||||||
case "JBIG2Decode":
|
case "JBIG2Decode":
|
||||||
xrefStats.addStreamType(StreamType.JBIG);
|
|
||||||
return new Jbig2Stream(stream, maybeLength, params);
|
return new Jbig2Stream(stream, maybeLength, params);
|
||||||
}
|
}
|
||||||
warn(`Filter "${name}" is not supported.`);
|
warn(`Filter "${name}" is not supported.`);
|
||||||
|
@ -82,9 +82,11 @@ class Pattern {
|
|||||||
if (ex instanceof MissingDataException) {
|
if (ex instanceof MissingDataException) {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
handler.send("UnsupportedFeature", {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
featureId: UNSUPPORTED_FEATURES.shadingPattern,
|
handler.send("UnsupportedFeature", {
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.shadingPattern,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(ex);
|
warn(ex);
|
||||||
return new DummyShading();
|
return new DummyShading();
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,13 @@ import {
|
|||||||
warn,
|
warn,
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
import { CIRCULAR_REF, Cmd, Dict, isCmd, Ref, RefSet } from "./primitives.js";
|
import { CIRCULAR_REF, Cmd, Dict, isCmd, Ref, RefSet } from "./primitives.js";
|
||||||
|
import { Lexer, Parser } from "./parser.js";
|
||||||
import {
|
import {
|
||||||
DocStats,
|
|
||||||
MissingDataException,
|
MissingDataException,
|
||||||
ParserEOFException,
|
ParserEOFException,
|
||||||
XRefEntryException,
|
XRefEntryException,
|
||||||
XRefParseException,
|
XRefParseException,
|
||||||
} from "./core_utils.js";
|
} from "./core_utils.js";
|
||||||
import { Lexer, Parser } from "./parser.js";
|
|
||||||
import { BaseStream } from "./base_stream.js";
|
import { BaseStream } from "./base_stream.js";
|
||||||
import { CipherTransformFactory } from "./crypto.js";
|
import { CipherTransformFactory } from "./crypto.js";
|
||||||
|
|
||||||
@ -41,7 +40,6 @@ class XRef {
|
|||||||
this.xrefstms = Object.create(null);
|
this.xrefstms = Object.create(null);
|
||||||
this._cacheMap = new Map(); // Prepare the XRef cache.
|
this._cacheMap = new Map(); // Prepare the XRef cache.
|
||||||
this._pendingRefs = new RefSet();
|
this._pendingRefs = new RefSet();
|
||||||
this.stats = new DocStats(pdfManager.msgHandler);
|
|
||||||
this._newPersistentRefNum = null;
|
this._newPersistentRefNum = null;
|
||||||
this._newTemporaryRefNum = null;
|
this._newTemporaryRefNum = null;
|
||||||
}
|
}
|
||||||
|
@ -609,10 +609,12 @@ class PDFDocumentLoadingTask {
|
|||||||
* @type {function}
|
* @type {function}
|
||||||
*/
|
*/
|
||||||
set onUnsupportedFeature(callback) {
|
set onUnsupportedFeature(callback) {
|
||||||
deprecated(
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
"The PDFDocumentLoadingTask onUnsupportedFeature property will be removed in the future."
|
deprecated(
|
||||||
);
|
"The PDFDocumentLoadingTask onUnsupportedFeature property will be removed in the future."
|
||||||
this.#onUnsupportedFeature = callback;
|
);
|
||||||
|
this.#onUnsupportedFeature = callback;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -758,27 +760,6 @@ class PDFDocumentProxy {
|
|||||||
return this._pdfInfo.fingerprints;
|
return this._pdfInfo.fingerprints;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} PDFDocumentStats
|
|
||||||
* @property {Object<string, boolean>} streamTypes - Used stream types in the
|
|
||||||
* document (an item is set to true if specific stream ID was used in the
|
|
||||||
* document).
|
|
||||||
* @property {Object<string, boolean>} fontTypes - Used font types in the
|
|
||||||
* document (an item is set to true if specific font ID was used in the
|
|
||||||
* document).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {PDFDocumentStats | null} The current statistics about document
|
|
||||||
* structures, or `null` when no statistics exists.
|
|
||||||
*/
|
|
||||||
get stats() {
|
|
||||||
deprecated(
|
|
||||||
"The PDFDocumentProxy stats property will be removed in the future."
|
|
||||||
);
|
|
||||||
return this._transport.stats;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean} True if only XFA form.
|
* @type {boolean} True if only XFA form.
|
||||||
*/
|
*/
|
||||||
@ -2296,8 +2277,6 @@ class PDFWorker {
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
class WorkerTransport {
|
class WorkerTransport {
|
||||||
#docStats = null;
|
|
||||||
|
|
||||||
#pageCache = new Map();
|
#pageCache = new Map();
|
||||||
|
|
||||||
#pagePromises = new Map();
|
#pagePromises = new Map();
|
||||||
@ -2341,10 +2320,6 @@ class WorkerTransport {
|
|||||||
return shadow(this, "annotationStorage", new AnnotationStorage());
|
return shadow(this, "annotationStorage", new AnnotationStorage());
|
||||||
}
|
}
|
||||||
|
|
||||||
get stats() {
|
|
||||||
return this.#docStats;
|
|
||||||
}
|
|
||||||
|
|
||||||
getRenderingIntent(
|
getRenderingIntent(
|
||||||
intent,
|
intent,
|
||||||
annotationMode = AnnotationMode.ENABLE,
|
annotationMode = AnnotationMode.ENABLE,
|
||||||
@ -2775,22 +2750,12 @@ class WorkerTransport {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
messageHandler.on("DocStats", data => {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
if (this.destroyed) {
|
messageHandler.on(
|
||||||
return; // Ignore any pending requests if the worker was terminated.
|
"UnsupportedFeature",
|
||||||
}
|
this._onUnsupportedFeature.bind(this)
|
||||||
// Ensure that a `PDFDocumentProxy.stats` call-site cannot accidentally
|
);
|
||||||
// modify this internal data.
|
}
|
||||||
this.#docStats = Object.freeze({
|
|
||||||
streamTypes: Object.freeze(data.streamTypes),
|
|
||||||
fontTypes: Object.freeze(data.fontTypes),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
messageHandler.on(
|
|
||||||
"UnsupportedFeature",
|
|
||||||
this._onUnsupportedFeature.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
messageHandler.on("FetchBuiltInCMap", data => {
|
messageHandler.on("FetchBuiltInCMap", data => {
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
@ -2822,10 +2787,12 @@ class WorkerTransport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onUnsupportedFeature({ featureId }) {
|
_onUnsupportedFeature({ featureId }) {
|
||||||
if (this.destroyed) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
return; // Ignore any pending requests if the worker was terminated.
|
if (this.destroyed) {
|
||||||
|
return; // Ignore any pending requests if the worker was terminated.
|
||||||
|
}
|
||||||
|
this.loadingTask.onUnsupportedFeature?.(featureId);
|
||||||
}
|
}
|
||||||
this.loadingTask.onUnsupportedFeature?.(featureId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getData() {
|
getData() {
|
||||||
|
@ -30,7 +30,9 @@ class FontLoader {
|
|||||||
ownerDocument = globalThis.document,
|
ownerDocument = globalThis.document,
|
||||||
styleElement = null, // For testing only.
|
styleElement = null, // For testing only.
|
||||||
}) {
|
}) {
|
||||||
this._onUnsupportedFeature = onUnsupportedFeature;
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
|
this._onUnsupportedFeature = onUnsupportedFeature;
|
||||||
|
}
|
||||||
this._document = ownerDocument;
|
this._document = ownerDocument;
|
||||||
|
|
||||||
this.nativeFontFaces = [];
|
this.nativeFontFaces = [];
|
||||||
@ -88,9 +90,11 @@ class FontLoader {
|
|||||||
try {
|
try {
|
||||||
await nativeFontFace.loaded;
|
await nativeFontFace.loaded;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this._onUnsupportedFeature({
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
featureId: UNSUPPORTED_FEATURES.errorFontLoadNative,
|
this._onUnsupportedFeature({
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorFontLoadNative,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
|
warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
|
||||||
|
|
||||||
// When font loading failed, fall back to the built-in font renderer.
|
// When font loading failed, fall back to the built-in font renderer.
|
||||||
@ -340,7 +344,9 @@ class FontFaceObject {
|
|||||||
this.isEvalSupported = isEvalSupported !== false;
|
this.isEvalSupported = isEvalSupported !== false;
|
||||||
this.disableFontFace = disableFontFace === true;
|
this.disableFontFace = disableFontFace === true;
|
||||||
this.ignoreErrors = ignoreErrors === true;
|
this.ignoreErrors = ignoreErrors === true;
|
||||||
this._onUnsupportedFeature = onUnsupportedFeature;
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
|
this._onUnsupportedFeature = onUnsupportedFeature;
|
||||||
|
}
|
||||||
this.fontRegistry = fontRegistry;
|
this.fontRegistry = fontRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,9 +409,11 @@ class FontFaceObject {
|
|||||||
if (!this.ignoreErrors) {
|
if (!this.ignoreErrors) {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
this._onUnsupportedFeature({
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
featureId: UNSUPPORTED_FEATURES.errorFontGetPath,
|
this._onUnsupportedFeature({
|
||||||
});
|
featureId: UNSUPPORTED_FEATURES.errorFontGetPath,
|
||||||
|
});
|
||||||
|
}
|
||||||
warn(`getPathGenerator - ignoring character: "${ex}".`);
|
warn(`getPathGenerator - ignoring character: "${ex}".`);
|
||||||
|
|
||||||
return (this.compiledGlyphs[character] = function (c, size) {
|
return (this.compiledGlyphs[character] = function (c, size) {
|
||||||
|
@ -236,34 +236,6 @@ const PageActionEventType = {
|
|||||||
C: "PageClose",
|
C: "PageClose",
|
||||||
};
|
};
|
||||||
|
|
||||||
const StreamType = {
|
|
||||||
UNKNOWN: "UNKNOWN",
|
|
||||||
FLATE: "FLATE",
|
|
||||||
LZW: "LZW",
|
|
||||||
DCT: "DCT",
|
|
||||||
JPX: "JPX",
|
|
||||||
JBIG: "JBIG",
|
|
||||||
A85: "A85",
|
|
||||||
AHX: "AHX",
|
|
||||||
CCF: "CCF",
|
|
||||||
RLX: "RLX", // PDF short name is 'RL', but telemetry requires three chars.
|
|
||||||
};
|
|
||||||
|
|
||||||
const FontType = {
|
|
||||||
UNKNOWN: "UNKNOWN",
|
|
||||||
TYPE1: "TYPE1",
|
|
||||||
TYPE1STANDARD: "TYPE1STANDARD",
|
|
||||||
TYPE1C: "TYPE1C",
|
|
||||||
CIDFONTTYPE0: "CIDFONTTYPE0",
|
|
||||||
CIDFONTTYPE0C: "CIDFONTTYPE0C",
|
|
||||||
TRUETYPE: "TRUETYPE",
|
|
||||||
CIDFONTTYPE2: "CIDFONTTYPE2",
|
|
||||||
TYPE3: "TYPE3",
|
|
||||||
OPENTYPE: "OPENTYPE",
|
|
||||||
TYPE0: "TYPE0",
|
|
||||||
MMTYPE1: "MMTYPE1",
|
|
||||||
};
|
|
||||||
|
|
||||||
const VerbosityLevel = {
|
const VerbosityLevel = {
|
||||||
ERRORS: 0,
|
ERRORS: 0,
|
||||||
WARNINGS: 1,
|
WARNINGS: 1,
|
||||||
@ -374,28 +346,31 @@ const OPS = {
|
|||||||
constructPath: 91,
|
constructPath: 91,
|
||||||
};
|
};
|
||||||
|
|
||||||
const UNSUPPORTED_FEATURES = {
|
const UNSUPPORTED_FEATURES =
|
||||||
forms: "forms",
|
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
|
||||||
javaScript: "javaScript",
|
? {
|
||||||
signatures: "signatures",
|
forms: "forms",
|
||||||
smask: "smask",
|
javaScript: "javaScript",
|
||||||
shadingPattern: "shadingPattern",
|
signatures: "signatures",
|
||||||
errorTilingPattern: "errorTilingPattern",
|
smask: "smask",
|
||||||
errorExtGState: "errorExtGState",
|
shadingPattern: "shadingPattern",
|
||||||
errorXObject: "errorXObject",
|
errorTilingPattern: "errorTilingPattern",
|
||||||
errorFontLoadType3: "errorFontLoadType3",
|
errorExtGState: "errorExtGState",
|
||||||
errorFontState: "errorFontState",
|
errorXObject: "errorXObject",
|
||||||
errorFontMissing: "errorFontMissing",
|
errorFontLoadType3: "errorFontLoadType3",
|
||||||
errorFontTranslate: "errorFontTranslate",
|
errorFontState: "errorFontState",
|
||||||
errorColorSpace: "errorColorSpace",
|
errorFontMissing: "errorFontMissing",
|
||||||
errorOperatorList: "errorOperatorList",
|
errorFontTranslate: "errorFontTranslate",
|
||||||
errorFontToUnicode: "errorFontToUnicode",
|
errorColorSpace: "errorColorSpace",
|
||||||
errorFontLoadNative: "errorFontLoadNative",
|
errorOperatorList: "errorOperatorList",
|
||||||
errorFontBuildPath: "errorFontBuildPath",
|
errorFontToUnicode: "errorFontToUnicode",
|
||||||
errorFontGetPath: "errorFontGetPath",
|
errorFontLoadNative: "errorFontLoadNative",
|
||||||
errorMarkedContent: "errorMarkedContent",
|
errorFontBuildPath: "errorFontBuildPath",
|
||||||
errorContentSubStream: "errorContentSubStream",
|
errorFontGetPath: "errorFontGetPath",
|
||||||
};
|
errorMarkedContent: "errorMarkedContent",
|
||||||
|
errorContentSubStream: "errorContentSubStream",
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
const PasswordResponses = {
|
const PasswordResponses = {
|
||||||
NEED_PASSWORD: 1,
|
NEED_PASSWORD: 1,
|
||||||
@ -1152,7 +1127,6 @@ export {
|
|||||||
DocumentActionEventType,
|
DocumentActionEventType,
|
||||||
FeatureTest,
|
FeatureTest,
|
||||||
FONT_IDENTITY_MATRIX,
|
FONT_IDENTITY_MATRIX,
|
||||||
FontType,
|
|
||||||
FormatError,
|
FormatError,
|
||||||
getModificationDate,
|
getModificationDate,
|
||||||
getVerbosityLevel,
|
getVerbosityLevel,
|
||||||
@ -1175,7 +1149,6 @@ export {
|
|||||||
RenderingIntentFlag,
|
RenderingIntentFlag,
|
||||||
setVerbosityLevel,
|
setVerbosityLevel,
|
||||||
shadow,
|
shadow,
|
||||||
StreamType,
|
|
||||||
string32,
|
string32,
|
||||||
stringToBytes,
|
stringToBytes,
|
||||||
stringToPDFString,
|
stringToPDFString,
|
||||||
|
@ -17,7 +17,6 @@ import {
|
|||||||
AnnotationMode,
|
AnnotationMode,
|
||||||
AnnotationType,
|
AnnotationType,
|
||||||
createPromiseCapability,
|
createPromiseCapability,
|
||||||
FontType,
|
|
||||||
ImageKind,
|
ImageKind,
|
||||||
InvalidPDFException,
|
InvalidPDFException,
|
||||||
MissingPDFException,
|
MissingPDFException,
|
||||||
@ -25,7 +24,6 @@ import {
|
|||||||
PasswordException,
|
PasswordException,
|
||||||
PasswordResponses,
|
PasswordResponses,
|
||||||
PermissionFlag,
|
PermissionFlag,
|
||||||
StreamType,
|
|
||||||
UnknownErrorException,
|
UnknownErrorException,
|
||||||
} from "../../src/shared/util.js";
|
} from "../../src/shared/util.js";
|
||||||
import {
|
import {
|
||||||
@ -1846,11 +1844,6 @@ describe("api", function () {
|
|||||||
expect(downloadInfo).toEqual({ length: basicApiFileLength });
|
expect(downloadInfo).toEqual({ length: basicApiFileLength });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("gets document stats", async function () {
|
|
||||||
const stats = pdfDocument.stats;
|
|
||||||
expect(stats).toEqual(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("cleans up document resources", async function () {
|
it("cleans up document resources", async function () {
|
||||||
await pdfDocument.cleanup();
|
await pdfDocument.cleanup();
|
||||||
|
|
||||||
@ -2761,24 +2754,6 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
|
|||||||
await loadingTask.destroy();
|
await loadingTask.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("gets document stats after parsing page", async function () {
|
|
||||||
await page.getOperatorList();
|
|
||||||
const stats = pdfDocument.stats;
|
|
||||||
|
|
||||||
const expectedStreamTypes = {
|
|
||||||
[StreamType.FLATE]: true,
|
|
||||||
};
|
|
||||||
const expectedFontTypes = {
|
|
||||||
[FontType.TYPE1STANDARD]: true,
|
|
||||||
[FontType.CIDFONTTYPE2]: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(stats).toEqual({
|
|
||||||
streamTypes: expectedStreamTypes,
|
|
||||||
fontTypes: expectedFontTypes,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("gets page stats after parsing page, without `pdfBug` set", async function () {
|
it("gets page stats after parsing page, without `pdfBug` set", async function () {
|
||||||
await page.getOperatorList();
|
await page.getOperatorList();
|
||||||
expect(page.stats).toEqual(null);
|
expect(page.stats).toEqual(null);
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import { NullStream, StringStream } from "../../src/core/stream.js";
|
import { NullStream, StringStream } from "../../src/core/stream.js";
|
||||||
import { Page, PDFDocument } from "../../src/core/document.js";
|
import { Page, PDFDocument } from "../../src/core/document.js";
|
||||||
import { assert } from "../../src/shared/util.js";
|
import { assert } from "../../src/shared/util.js";
|
||||||
import { DocStats } from "../../src/core/core_utils.js";
|
|
||||||
import { isNodeJS } from "../../src/shared/is_node.js";
|
import { isNodeJS } from "../../src/shared/is_node.js";
|
||||||
import { Ref } from "../../src/core/primitives.js";
|
import { Ref } from "../../src/core/primitives.js";
|
||||||
|
|
||||||
@ -77,7 +76,6 @@ function buildGetDocumentParams(filename, options) {
|
|||||||
class XRefMock {
|
class XRefMock {
|
||||||
constructor(array) {
|
constructor(array) {
|
||||||
this._map = Object.create(null);
|
this._map = Object.create(null);
|
||||||
this.stats = new DocStats({ send: () => {} });
|
|
||||||
this._newTemporaryRefNum = null;
|
this._newTemporaryRefNum = null;
|
||||||
this._newPersistentRefNum = null;
|
this._newPersistentRefNum = null;
|
||||||
this.stream = new NullStream();
|
this.stream = new NullStream();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user