Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally bundle gulp image_decoders-specific code in src/core/jbig2.js (PR 9729 follow-up) #14994

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/core/jbig2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1473,8 +1473,7 @@ function processSegment(segment, visitor) {
break;
default:
throw new Jbig2Error(
`segment type ${header.typeName}(${header.type})` +
" is not implemented"
`segment type ${header.typeName}(${header.type}) is not implemented`
);
}
const callbackName = "on" + header.typeName;
Expand All @@ -1500,6 +1499,9 @@ function parseJbig2Chunks(chunks) {
}

function parseJbig2(data) {
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("IMAGE_DECODERS")) {
throw new Error("Not implemented: parseJbig2");
}
const end = data.length;
let position = 0;

Expand Down Expand Up @@ -2560,6 +2562,9 @@ class Jbig2Image {
}

parse(data) {
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("IMAGE_DECODERS")) {
throw new Error("Not implemented: Jbig2Image.parse");
}
const { imgData, width, height } = parseJbig2(data);
this.width = width;
this.height = height;
Expand Down