How to use Jbig2Error method in wpt

Best JavaScript code snippet using wpt

jbig2.js

Source:jbig2.js Github

copy

Full Screen

...26exports.Jbig2Image = undefined;27var _util = require('../shared/util');28var _arithmetic_decoder = require('./arithmetic_decoder');29var Jbig2Error = function Jbig2ErrorClosure() {30 function Jbig2Error(msg) {31 this.message = 'JBIG2 error: ' + msg;32 }33 Jbig2Error.prototype = new Error();34 Jbig2Error.prototype.name = 'Jbig2Error';35 Jbig2Error.constructor = Jbig2Error;36 return Jbig2Error;37}();38var Jbig2Image = function Jbig2ImageClosure() {39 function ContextCache() {}40 ContextCache.prototype = {41 getContexts: function getContexts(id) {42 if (id in this) {43 return this[id];44 }45 return this[id] = new Int8Array(1 << 16);46 }47 };48 function DecodingContext(data, start, end) {49 this.data = data;50 this.start = start;51 this.end = end;52 }53 DecodingContext.prototype = {54 get decoder() {55 var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);56 return (0, _util.shadow)(this, 'decoder', decoder);57 },58 get contextCache() {59 var cache = new ContextCache();60 return (0, _util.shadow)(this, 'contextCache', cache);61 }62 };63 function decodeInteger(contextCache, procedure, decoder) {64 var contexts = contextCache.getContexts(procedure);65 var prev = 1;66 function readBits(length) {67 var v = 0;68 for (var i = 0; i < length; i++) {69 var bit = decoder.readBit(contexts, prev);70 prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;71 v = v << 1 | bit;72 }73 return v >>> 0;74 }75 var sign = readBits(1);76 var value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);77 return sign === 0 ? value : value > 0 ? -value : null;78 }79 function decodeIAID(contextCache, decoder, codeLength) {80 var contexts = contextCache.getContexts('IAID');81 var prev = 1;82 for (var i = 0; i < codeLength; i++) {83 var bit = decoder.readBit(contexts, prev);84 prev = prev << 1 | bit;85 }86 if (codeLength < 31) {87 return prev & (1 << codeLength) - 1;88 }89 return prev & 0x7FFFFFFF;90 }91 var SegmentTypes = ['SymbolDictionary', null, null, null, 'IntermediateTextRegion', null, 'ImmediateTextRegion', 'ImmediateLosslessTextRegion', null, null, null, null, null, null, null, null, 'PatternDictionary', null, null, null, 'IntermediateHalftoneRegion', null, 'ImmediateHalftoneRegion', 'ImmediateLosslessHalftoneRegion', null, null, null, null, null, null, null, null, null, null, null, null, 'IntermediateGenericRegion', null, 'ImmediateGenericRegion', 'ImmediateLosslessGenericRegion', 'IntermediateGenericRefinementRegion', null, 'ImmediateGenericRefinementRegion', 'ImmediateLosslessGenericRefinementRegion', null, null, null, null, 'PageInformation', 'EndOfPage', 'EndOfStripe', 'EndOfFile', 'Profiles', 'Tables', null, null, null, null, null, null, null, null, 'Extension'];92 var CodingTemplates = [[{93 x: -1,94 y: -295 }, {96 x: 0,97 y: -298 }, {99 x: 1,100 y: -2101 }, {102 x: -2,103 y: -1104 }, {105 x: -1,106 y: -1107 }, {108 x: 0,109 y: -1110 }, {111 x: 1,112 y: -1113 }, {114 x: 2,115 y: -1116 }, {117 x: -4,118 y: 0119 }, {120 x: -3,121 y: 0122 }, {123 x: -2,124 y: 0125 }, {126 x: -1,127 y: 0128 }], [{129 x: -1,130 y: -2131 }, {132 x: 0,133 y: -2134 }, {135 x: 1,136 y: -2137 }, {138 x: 2,139 y: -2140 }, {141 x: -2,142 y: -1143 }, {144 x: -1,145 y: -1146 }, {147 x: 0,148 y: -1149 }, {150 x: 1,151 y: -1152 }, {153 x: 2,154 y: -1155 }, {156 x: -3,157 y: 0158 }, {159 x: -2,160 y: 0161 }, {162 x: -1,163 y: 0164 }], [{165 x: -1,166 y: -2167 }, {168 x: 0,169 y: -2170 }, {171 x: 1,172 y: -2173 }, {174 x: -2,175 y: -1176 }, {177 x: -1,178 y: -1179 }, {180 x: 0,181 y: -1182 }, {183 x: 1,184 y: -1185 }, {186 x: -2,187 y: 0188 }, {189 x: -1,190 y: 0191 }], [{192 x: -3,193 y: -1194 }, {195 x: -2,196 y: -1197 }, {198 x: -1,199 y: -1200 }, {201 x: 0,202 y: -1203 }, {204 x: 1,205 y: -1206 }, {207 x: -4,208 y: 0209 }, {210 x: -3,211 y: 0212 }, {213 x: -2,214 y: 0215 }, {216 x: -1,217 y: 0218 }]];219 var RefinementTemplates = [{220 coding: [{221 x: 0,222 y: -1223 }, {224 x: 1,225 y: -1226 }, {227 x: -1,228 y: 0229 }],230 reference: [{231 x: 0,232 y: -1233 }, {234 x: 1,235 y: -1236 }, {237 x: -1,238 y: 0239 }, {240 x: 0,241 y: 0242 }, {243 x: 1,244 y: 0245 }, {246 x: -1,247 y: 1248 }, {249 x: 0,250 y: 1251 }, {252 x: 1,253 y: 1254 }]255 }, {256 coding: [{257 x: -1,258 y: -1259 }, {260 x: 0,261 y: -1262 }, {263 x: 1,264 y: -1265 }, {266 x: -1,267 y: 0268 }],269 reference: [{270 x: 0,271 y: -1272 }, {273 x: -1,274 y: 0275 }, {276 x: 0,277 y: 0278 }, {279 x: 1,280 y: 0281 }, {282 x: 0,283 y: 1284 }, {285 x: 1,286 y: 1287 }]288 }];289 var ReusedContexts = [0x9B25, 0x0795, 0x00E5, 0x0195];290 var RefinementReusedContexts = [0x0020, 0x0008];291 function decodeBitmapTemplate0(width, height, decodingContext) {292 var decoder = decodingContext.decoder;293 var contexts = decodingContext.contextCache.getContexts('GB');294 var contextLabel,295 i,296 j,297 pixel,298 row,299 row1,300 row2,301 bitmap = [];302 var OLD_PIXEL_MASK = 0x7BF7;303 for (i = 0; i < height; i++) {304 row = bitmap[i] = new Uint8Array(width);305 row1 = i < 1 ? row : bitmap[i - 1];306 row2 = i < 2 ? row : bitmap[i - 2];307 contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;308 for (j = 0; j < width; j++) {309 row[j] = pixel = decoder.readBit(contexts, contextLabel);310 contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;311 }312 }313 return bitmap;314 }315 function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {316 if (mmr) {317 throw new Jbig2Error('MMR encoding is not supported');318 }319 if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {320 return decodeBitmapTemplate0(width, height, decodingContext);321 }322 var useskip = !!skip;323 var template = CodingTemplates[templateIndex].concat(at);324 template.sort(function (a, b) {325 return a.y - b.y || a.x - b.x;326 });327 var templateLength = template.length;328 var templateX = new Int8Array(templateLength);329 var templateY = new Int8Array(templateLength);330 var changingTemplateEntries = [];331 var reuseMask = 0,332 minX = 0,333 maxX = 0,334 minY = 0;335 var c, k;336 for (k = 0; k < templateLength; k++) {337 templateX[k] = template[k].x;338 templateY[k] = template[k].y;339 minX = Math.min(minX, template[k].x);340 maxX = Math.max(maxX, template[k].x);341 minY = Math.min(minY, template[k].y);342 if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {343 reuseMask |= 1 << templateLength - 1 - k;344 } else {345 changingTemplateEntries.push(k);346 }347 }348 var changingEntriesLength = changingTemplateEntries.length;349 var changingTemplateX = new Int8Array(changingEntriesLength);350 var changingTemplateY = new Int8Array(changingEntriesLength);351 var changingTemplateBit = new Uint16Array(changingEntriesLength);352 for (c = 0; c < changingEntriesLength; c++) {353 k = changingTemplateEntries[c];354 changingTemplateX[c] = template[k].x;355 changingTemplateY[c] = template[k].y;356 changingTemplateBit[c] = 1 << templateLength - 1 - k;357 }358 var sbb_left = -minX;359 var sbb_top = -minY;360 var sbb_right = width - maxX;361 var pseudoPixelContext = ReusedContexts[templateIndex];362 var row = new Uint8Array(width);363 var bitmap = [];364 var decoder = decodingContext.decoder;365 var contexts = decodingContext.contextCache.getContexts('GB');366 var ltp = 0,367 j,368 i0,369 j0,370 contextLabel = 0,371 bit,372 shift;373 for (var i = 0; i < height; i++) {374 if (prediction) {375 var sltp = decoder.readBit(contexts, pseudoPixelContext);376 ltp ^= sltp;377 if (ltp) {378 bitmap.push(row);379 continue;380 }381 }382 row = new Uint8Array(row);383 bitmap.push(row);384 for (j = 0; j < width; j++) {385 if (useskip && skip[i][j]) {386 row[j] = 0;387 continue;388 }389 if (j >= sbb_left && j < sbb_right && i >= sbb_top) {390 contextLabel = contextLabel << 1 & reuseMask;391 for (k = 0; k < changingEntriesLength; k++) {392 i0 = i + changingTemplateY[k];393 j0 = j + changingTemplateX[k];394 bit = bitmap[i0][j0];395 if (bit) {396 bit = changingTemplateBit[k];397 contextLabel |= bit;398 }399 }400 } else {401 contextLabel = 0;402 shift = templateLength - 1;403 for (k = 0; k < templateLength; k++, shift--) {404 j0 = j + templateX[k];405 if (j0 >= 0 && j0 < width) {406 i0 = i + templateY[k];407 if (i0 >= 0) {408 bit = bitmap[i0][j0];409 if (bit) {410 contextLabel |= bit << shift;411 }412 }413 }414 }415 }416 var pixel = decoder.readBit(contexts, contextLabel);417 row[j] = pixel;418 }419 }420 return bitmap;421 }422 function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {423 var codingTemplate = RefinementTemplates[templateIndex].coding;424 if (templateIndex === 0) {425 codingTemplate = codingTemplate.concat([at[0]]);426 }427 var codingTemplateLength = codingTemplate.length;428 var codingTemplateX = new Int32Array(codingTemplateLength);429 var codingTemplateY = new Int32Array(codingTemplateLength);430 var k;431 for (k = 0; k < codingTemplateLength; k++) {432 codingTemplateX[k] = codingTemplate[k].x;433 codingTemplateY[k] = codingTemplate[k].y;434 }435 var referenceTemplate = RefinementTemplates[templateIndex].reference;436 if (templateIndex === 0) {437 referenceTemplate = referenceTemplate.concat([at[1]]);438 }439 var referenceTemplateLength = referenceTemplate.length;440 var referenceTemplateX = new Int32Array(referenceTemplateLength);441 var referenceTemplateY = new Int32Array(referenceTemplateLength);442 for (k = 0; k < referenceTemplateLength; k++) {443 referenceTemplateX[k] = referenceTemplate[k].x;444 referenceTemplateY[k] = referenceTemplate[k].y;445 }446 var referenceWidth = referenceBitmap[0].length;447 var referenceHeight = referenceBitmap.length;448 var pseudoPixelContext = RefinementReusedContexts[templateIndex];449 var bitmap = [];450 var decoder = decodingContext.decoder;451 var contexts = decodingContext.contextCache.getContexts('GR');452 var ltp = 0;453 for (var i = 0; i < height; i++) {454 if (prediction) {455 var sltp = decoder.readBit(contexts, pseudoPixelContext);456 ltp ^= sltp;457 if (ltp) {458 throw new Jbig2Error('prediction is not supported');459 }460 }461 var row = new Uint8Array(width);462 bitmap.push(row);463 for (var j = 0; j < width; j++) {464 var i0, j0;465 var contextLabel = 0;466 for (k = 0; k < codingTemplateLength; k++) {467 i0 = i + codingTemplateY[k];468 j0 = j + codingTemplateX[k];469 if (i0 < 0 || j0 < 0 || j0 >= width) {470 contextLabel <<= 1;471 } else {472 contextLabel = contextLabel << 1 | bitmap[i0][j0];473 }474 }475 for (k = 0; k < referenceTemplateLength; k++) {476 i0 = i + referenceTemplateY[k] - offsetY;477 j0 = j + referenceTemplateX[k] - offsetX;478 if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {479 contextLabel <<= 1;480 } else {481 contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];482 }483 }484 var pixel = decoder.readBit(contexts, contextLabel);485 row[j] = pixel;486 }487 }488 return bitmap;489 }490 function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {491 if (huffman) {492 throw new Jbig2Error('huffman is not supported');493 }494 var newSymbols = [];495 var currentHeight = 0;496 var symbolCodeLength = (0, _util.log2)(symbols.length + numberOfNewSymbols);497 var decoder = decodingContext.decoder;498 var contextCache = decodingContext.contextCache;499 while (newSymbols.length < numberOfNewSymbols) {500 var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);501 currentHeight += deltaHeight;502 var currentWidth = 0;503 while (true) {504 var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);505 if (deltaWidth === null) {506 break;507 }508 currentWidth += deltaWidth;509 var bitmap;510 if (refinement) {511 var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);512 if (numberOfInstances > 1) {513 bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);514 } else {515 var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);516 var rdx = decodeInteger(contextCache, 'IARDX', decoder);517 var rdy = decodeInteger(contextCache, 'IARDY', decoder);518 var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];519 bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);520 }521 } else {522 bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);523 }524 newSymbols.push(bitmap);525 }526 }527 var exportedSymbols = [];528 var flags = [],529 currentFlag = false;530 var totalSymbolsLength = symbols.length + numberOfNewSymbols;531 while (flags.length < totalSymbolsLength) {532 var runLength = decodeInteger(contextCache, 'IAEX', decoder);533 while (runLength--) {534 flags.push(currentFlag);535 }536 currentFlag = !currentFlag;537 }538 for (var i = 0, ii = symbols.length; i < ii; i++) {539 if (flags[i]) {540 exportedSymbols.push(symbols[i]);541 }542 }543 for (var j = 0; j < numberOfNewSymbols; i++, j++) {544 if (flags[i]) {545 exportedSymbols.push(newSymbols[j]);546 }547 }548 return exportedSymbols;549 }550 function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {551 if (huffman) {552 throw new Jbig2Error('huffman is not supported');553 }554 var bitmap = [];555 var i, row;556 for (i = 0; i < height; i++) {557 row = new Uint8Array(width);558 if (defaultPixelValue) {559 for (var j = 0; j < width; j++) {560 row[j] = defaultPixelValue;561 }562 }563 bitmap.push(row);564 }565 var decoder = decodingContext.decoder;566 var contextCache = decodingContext.contextCache;567 var stripT = -decodeInteger(contextCache, 'IADT', decoder);568 var firstS = 0;569 i = 0;570 while (i < numberOfSymbolInstances) {571 var deltaT = decodeInteger(contextCache, 'IADT', decoder);572 stripT += deltaT;573 var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);574 firstS += deltaFirstS;575 var currentS = firstS;576 do {577 var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);578 var t = stripSize * stripT + currentT;579 var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);580 var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);581 var symbolBitmap = inputSymbols[symbolId];582 var symbolWidth = symbolBitmap[0].length;583 var symbolHeight = symbolBitmap.length;584 if (applyRefinement) {585 var rdw = decodeInteger(contextCache, 'IARDW', decoder);586 var rdh = decodeInteger(contextCache, 'IARDH', decoder);587 var rdx = decodeInteger(contextCache, 'IARDX', decoder);588 var rdy = decodeInteger(contextCache, 'IARDY', decoder);589 symbolWidth += rdw;590 symbolHeight += rdh;591 symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);592 }593 var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);594 var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);595 var s2, t2, symbolRow;596 if (transposed) {597 for (s2 = 0; s2 < symbolHeight; s2++) {598 row = bitmap[offsetS + s2];599 if (!row) {600 continue;601 }602 symbolRow = symbolBitmap[s2];603 var maxWidth = Math.min(width - offsetT, symbolWidth);604 switch (combinationOperator) {605 case 0:606 for (t2 = 0; t2 < maxWidth; t2++) {607 row[offsetT + t2] |= symbolRow[t2];608 }609 break;610 case 2:611 for (t2 = 0; t2 < maxWidth; t2++) {612 row[offsetT + t2] ^= symbolRow[t2];613 }614 break;615 default:616 throw new Jbig2Error('operator ' + combinationOperator + ' is not supported');617 }618 }619 currentS += symbolHeight - 1;620 } else {621 for (t2 = 0; t2 < symbolHeight; t2++) {622 row = bitmap[offsetT + t2];623 if (!row) {624 continue;625 }626 symbolRow = symbolBitmap[t2];627 switch (combinationOperator) {628 case 0:629 for (s2 = 0; s2 < symbolWidth; s2++) {630 row[offsetS + s2] |= symbolRow[s2];631 }632 break;633 case 2:634 for (s2 = 0; s2 < symbolWidth; s2++) {635 row[offsetS + s2] ^= symbolRow[s2];636 }637 break;638 default:639 throw new Jbig2Error('operator ' + combinationOperator + ' is not supported');640 }641 }642 currentS += symbolWidth - 1;643 }644 i++;645 var deltaS = decodeInteger(contextCache, 'IADS', decoder);646 if (deltaS === null) {647 break;648 }649 currentS += deltaS + dsOffset;650 } while (true);651 }652 return bitmap;653 }654 function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {655 var at = [];656 at.push({657 x: -patternWidth,658 y: 0659 });660 if (template === 0) {661 at.push({662 x: -3,663 y: -1664 });665 at.push({666 x: 2,667 y: -2668 });669 at.push({670 x: -2,671 y: -2672 });673 }674 var collectiveWidth = (maxPatternIndex + 1) * patternWidth;675 var collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);676 var patterns = [],677 i = 0,678 patternBitmap = void 0,679 xMin = void 0,680 xMax = void 0,681 y = void 0;682 while (i <= maxPatternIndex) {683 patternBitmap = [];684 xMin = patternWidth * i;685 xMax = xMin + patternWidth;686 for (y = 0; y < patternHeight; y++) {687 patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));688 }689 patterns.push(patternBitmap);690 i++;691 }692 return patterns;693 }694 function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {695 var skip = null;696 if (enableSkip) {697 throw new Jbig2Error('skip is not supported');698 }699 if (combinationOperator !== 0) {700 throw new Jbig2Error('operator ' + combinationOperator + ' is not supported in halftone region');701 }702 var regionBitmap = [];703 var i = void 0,704 j = void 0,705 row = void 0;706 for (i = 0; i < regionHeight; i++) {707 row = new Uint8Array(regionWidth);708 if (defaultPixelValue) {709 for (j = 0; j < regionWidth; j++) {710 row[j] = defaultPixelValue;711 }712 }713 regionBitmap.push(row);714 }715 var numberOfPatterns = patterns.length;716 var pattern0 = patterns[0];717 var patternWidth = pattern0[0].length,718 patternHeight = pattern0.length;719 var bitsPerValue = (0, _util.log2)(numberOfPatterns);720 var at = [];721 at.push({722 x: template <= 1 ? 3 : 2,723 y: -1724 });725 if (template === 0) {726 at.push({727 x: -3,728 y: -1729 });730 at.push({731 x: 2,732 y: -2733 });734 at.push({735 x: -2,736 y: -2737 });738 }739 var grayScaleBitPlanes = [];740 for (i = bitsPerValue - 1; i >= 0; i--) {741 grayScaleBitPlanes[i] = decodeBitmap(mmr, gridWidth, gridHeight, template, false, skip, at, decodingContext);742 }743 var mg = void 0,744 ng = void 0,745 bit = void 0,746 patternIndex = void 0,747 patternBitmap = void 0,748 x = void 0,749 y = void 0,750 patternRow = void 0,751 regionRow = void 0;752 for (mg = 0; mg < gridHeight; mg++) {753 for (ng = 0; ng < gridWidth; ng++) {754 bit = 0;755 patternIndex = 0;756 for (j = bitsPerValue - 1; j >= 0; j--) {757 bit = grayScaleBitPlanes[j][mg][ng] ^ bit;758 patternIndex |= bit << j;759 }760 patternBitmap = patterns[patternIndex];761 x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;762 y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;763 if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {764 for (i = 0; i < patternHeight; i++) {765 regionRow = regionBitmap[y + i];766 patternRow = patternBitmap[i];767 for (j = 0; j < patternWidth; j++) {768 regionRow[x + j] |= patternRow[j];769 }770 }771 } else {772 var regionX = void 0,773 regionY = void 0;774 for (i = 0; i < patternHeight; i++) {775 regionY = y + i;776 if (regionY < 0 || regionY >= regionHeight) {777 continue;778 }779 regionRow = regionBitmap[regionY];780 patternRow = patternBitmap[i];781 for (j = 0; j < patternWidth; j++) {782 regionX = x + j;783 if (regionX >= 0 && regionX < regionWidth) {784 regionRow[regionX] |= patternRow[j];785 }786 }787 }788 }789 }790 }791 return regionBitmap;792 }793 function readSegmentHeader(data, start) {794 var segmentHeader = {};795 segmentHeader.number = (0, _util.readUint32)(data, start);796 var flags = data[start + 4];797 var segmentType = flags & 0x3F;798 if (!SegmentTypes[segmentType]) {799 throw new Jbig2Error('invalid segment type: ' + segmentType);800 }801 segmentHeader.type = segmentType;802 segmentHeader.typeName = SegmentTypes[segmentType];803 segmentHeader.deferredNonRetain = !!(flags & 0x80);804 var pageAssociationFieldSize = !!(flags & 0x40);805 var referredFlags = data[start + 5];806 var referredToCount = referredFlags >> 5 & 7;807 var retainBits = [referredFlags & 31];808 var position = start + 6;809 if (referredFlags === 7) {810 referredToCount = (0, _util.readUint32)(data, position - 1) & 0x1FFFFFFF;811 position += 3;812 var bytes = referredToCount + 7 >> 3;813 retainBits[0] = data[position++];814 while (--bytes > 0) {815 retainBits.push(data[position++]);816 }817 } else if (referredFlags === 5 || referredFlags === 6) {818 throw new Jbig2Error('invalid referred-to flags');819 }820 segmentHeader.retainBits = retainBits;821 var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;822 var referredTo = [];823 var i, ii;824 for (i = 0; i < referredToCount; i++) {825 var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? (0, _util.readUint16)(data, position) : (0, _util.readUint32)(data, position);826 referredTo.push(number);827 position += referredToSegmentNumberSize;828 }829 segmentHeader.referredTo = referredTo;830 if (!pageAssociationFieldSize) {831 segmentHeader.pageAssociation = data[position++];832 } else {833 segmentHeader.pageAssociation = (0, _util.readUint32)(data, position);834 position += 4;835 }836 segmentHeader.length = (0, _util.readUint32)(data, position);837 position += 4;838 if (segmentHeader.length === 0xFFFFFFFF) {839 if (segmentType === 38) {840 var genericRegionInfo = readRegionSegmentInformation(data, position);841 var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];842 var genericRegionMmr = !!(genericRegionSegmentFlags & 1);843 var searchPatternLength = 6;844 var searchPattern = new Uint8Array(searchPatternLength);845 if (!genericRegionMmr) {846 searchPattern[0] = 0xFF;847 searchPattern[1] = 0xAC;848 }849 searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;850 searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;851 searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;852 searchPattern[5] = genericRegionInfo.height & 0xFF;853 for (i = position, ii = data.length; i < ii; i++) {854 var j = 0;855 while (j < searchPatternLength && searchPattern[j] === data[i + j]) {856 j++;857 }858 if (j === searchPatternLength) {859 segmentHeader.length = i + searchPatternLength;860 break;861 }862 }863 if (segmentHeader.length === 0xFFFFFFFF) {864 throw new Jbig2Error('segment end was not found');865 }866 } else {867 throw new Jbig2Error('invalid unknown segment length');868 }869 }870 segmentHeader.headerEnd = position;871 return segmentHeader;872 }873 function readSegments(header, data, start, end) {874 var segments = [];875 var position = start;876 while (position < end) {877 var segmentHeader = readSegmentHeader(data, position);878 position = segmentHeader.headerEnd;879 var segment = {880 header: segmentHeader,881 data: data882 };883 if (!header.randomAccess) {884 segment.start = position;885 position += segmentHeader.length;886 segment.end = position;887 }888 segments.push(segment);889 if (segmentHeader.type === 51) {890 break;891 }892 }893 if (header.randomAccess) {894 for (var i = 0, ii = segments.length; i < ii; i++) {895 segments[i].start = position;896 position += segments[i].header.length;897 segments[i].end = position;898 }899 }900 return segments;901 }902 function readRegionSegmentInformation(data, start) {903 return {904 width: (0, _util.readUint32)(data, start),905 height: (0, _util.readUint32)(data, start + 4),906 x: (0, _util.readUint32)(data, start + 8),907 y: (0, _util.readUint32)(data, start + 12),908 combinationOperator: data[start + 16] & 7909 };910 }911 var RegionSegmentInformationFieldLength = 17;912 function processSegment(segment, visitor) {913 var header = segment.header;914 var data = segment.data,915 position = segment.start,916 end = segment.end;917 var args, at, i, atLength;918 switch (header.type) {919 case 0:920 var dictionary = {};921 var dictionaryFlags = (0, _util.readUint16)(data, position);922 dictionary.huffman = !!(dictionaryFlags & 1);923 dictionary.refinement = !!(dictionaryFlags & 2);924 dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;925 dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;926 dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;927 dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;928 dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);929 dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);930 dictionary.template = dictionaryFlags >> 10 & 3;931 dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;932 position += 2;933 if (!dictionary.huffman) {934 atLength = dictionary.template === 0 ? 4 : 1;935 at = [];936 for (i = 0; i < atLength; i++) {937 at.push({938 x: (0, _util.readInt8)(data, position),939 y: (0, _util.readInt8)(data, position + 1)940 });941 position += 2;942 }943 dictionary.at = at;944 }945 if (dictionary.refinement && !dictionary.refinementTemplate) {946 at = [];947 for (i = 0; i < 2; i++) {948 at.push({949 x: (0, _util.readInt8)(data, position),950 y: (0, _util.readInt8)(data, position + 1)951 });952 position += 2;953 }954 dictionary.refinementAt = at;955 }956 dictionary.numberOfExportedSymbols = (0, _util.readUint32)(data, position);957 position += 4;958 dictionary.numberOfNewSymbols = (0, _util.readUint32)(data, position);959 position += 4;960 args = [dictionary, header.number, header.referredTo, data, position, end];961 break;962 case 6:963 case 7:964 var textRegion = {};965 textRegion.info = readRegionSegmentInformation(data, position);966 position += RegionSegmentInformationFieldLength;967 var textRegionSegmentFlags = (0, _util.readUint16)(data, position);968 position += 2;969 textRegion.huffman = !!(textRegionSegmentFlags & 1);970 textRegion.refinement = !!(textRegionSegmentFlags & 2);971 textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);972 textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;973 textRegion.transposed = !!(textRegionSegmentFlags & 64);974 textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;975 textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;976 textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;977 textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;978 if (textRegion.huffman) {979 var textRegionHuffmanFlags = (0, _util.readUint16)(data, position);980 position += 2;981 textRegion.huffmanFS = textRegionHuffmanFlags & 3;982 textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;983 textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;984 textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;985 textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;986 textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;987 textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;988 textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);989 }990 if (textRegion.refinement && !textRegion.refinementTemplate) {991 at = [];992 for (i = 0; i < 2; i++) {993 at.push({994 x: (0, _util.readInt8)(data, position),995 y: (0, _util.readInt8)(data, position + 1)996 });997 position += 2;998 }999 textRegion.refinementAt = at;1000 }1001 textRegion.numberOfSymbolInstances = (0, _util.readUint32)(data, position);1002 position += 4;1003 if (textRegion.huffman) {1004 throw new Jbig2Error('huffman is not supported');1005 }1006 args = [textRegion, header.referredTo, data, position, end];1007 break;1008 case 16:1009 var patternDictionary = {};1010 var patternDictionaryFlags = data[position++];1011 patternDictionary.mmr = !!(patternDictionaryFlags & 1);1012 patternDictionary.template = patternDictionaryFlags >> 1 & 3;1013 patternDictionary.patternWidth = data[position++];1014 patternDictionary.patternHeight = data[position++];1015 patternDictionary.maxPatternIndex = (0, _util.readUint32)(data, position);1016 position += 4;1017 args = [patternDictionary, header.number, data, position, end];1018 break;1019 case 22:1020 case 23:1021 var halftoneRegion = {};1022 halftoneRegion.info = readRegionSegmentInformation(data, position);1023 position += RegionSegmentInformationFieldLength;1024 var halftoneRegionFlags = data[position++];1025 halftoneRegion.mmr = !!(halftoneRegionFlags & 1);1026 halftoneRegion.template = halftoneRegionFlags >> 1 & 3;1027 halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);1028 halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;1029 halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;1030 halftoneRegion.gridWidth = (0, _util.readUint32)(data, position);1031 position += 4;1032 halftoneRegion.gridHeight = (0, _util.readUint32)(data, position);1033 position += 4;1034 halftoneRegion.gridOffsetX = (0, _util.readUint32)(data, position) & 0xFFFFFFFF;1035 position += 4;1036 halftoneRegion.gridOffsetY = (0, _util.readUint32)(data, position) & 0xFFFFFFFF;1037 position += 4;1038 halftoneRegion.gridVectorX = (0, _util.readUint16)(data, position);1039 position += 2;1040 halftoneRegion.gridVectorY = (0, _util.readUint16)(data, position);1041 position += 2;1042 args = [halftoneRegion, header.referredTo, data, position, end];1043 break;1044 case 38:1045 case 39:1046 var genericRegion = {};1047 genericRegion.info = readRegionSegmentInformation(data, position);1048 position += RegionSegmentInformationFieldLength;1049 var genericRegionSegmentFlags = data[position++];1050 genericRegion.mmr = !!(genericRegionSegmentFlags & 1);1051 genericRegion.template = genericRegionSegmentFlags >> 1 & 3;1052 genericRegion.prediction = !!(genericRegionSegmentFlags & 8);1053 if (!genericRegion.mmr) {1054 atLength = genericRegion.template === 0 ? 4 : 1;1055 at = [];1056 for (i = 0; i < atLength; i++) {1057 at.push({1058 x: (0, _util.readInt8)(data, position),1059 y: (0, _util.readInt8)(data, position + 1)1060 });1061 position += 2;1062 }1063 genericRegion.at = at;1064 }1065 args = [genericRegion, data, position, end];1066 break;1067 case 48:1068 var pageInfo = {1069 width: (0, _util.readUint32)(data, position),1070 height: (0, _util.readUint32)(data, position + 4),1071 resolutionX: (0, _util.readUint32)(data, position + 8),1072 resolutionY: (0, _util.readUint32)(data, position + 12)1073 };1074 if (pageInfo.height === 0xFFFFFFFF) {1075 delete pageInfo.height;1076 }1077 var pageSegmentFlags = data[position + 16];1078 (0, _util.readUint16)(data, position + 17);1079 pageInfo.lossless = !!(pageSegmentFlags & 1);1080 pageInfo.refinement = !!(pageSegmentFlags & 2);1081 pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;1082 pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;1083 pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);1084 pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);1085 args = [pageInfo];1086 break;1087 case 49:1088 break;1089 case 50:1090 break;1091 case 51:1092 break;1093 case 62:1094 break;1095 default:1096 throw new Jbig2Error('segment type ' + header.typeName + '(' + header.type + ')' + ' is not implemented');1097 }1098 var callbackName = 'on' + header.typeName;1099 if (callbackName in visitor) {1100 visitor[callbackName].apply(visitor, args);1101 }1102 }1103 function processSegments(segments, visitor) {1104 for (var i = 0, ii = segments.length; i < ii; i++) {1105 processSegment(segments[i], visitor);1106 }1107 }1108 function parseJbig2(data, start, end) {1109 var position = start;1110 if (data[position] !== 0x97 || data[position + 1] !== 0x4A || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0D || data[position + 5] !== 0x0A || data[position + 6] !== 0x1A || data[position + 7] !== 0x0A) {1111 throw new Jbig2Error('invalid header');1112 }1113 var header = {};1114 position += 8;1115 var flags = data[position++];1116 header.randomAccess = !(flags & 1);1117 if (!(flags & 2)) {1118 header.numberOfPages = (0, _util.readUint32)(data, position);1119 position += 4;1120 }1121 readSegments(header, data, position, end);1122 throw new Error('Not implemented');1123 }1124 function parseJbig2Chunks(chunks) {1125 var visitor = new SimpleSegmentVisitor();1126 for (var i = 0, ii = chunks.length; i < ii; i++) {1127 var chunk = chunks[i];1128 var segments = readSegments({}, chunk.data, chunk.start, chunk.end);1129 processSegments(segments, visitor);1130 }1131 return visitor.buffer;1132 }1133 function SimpleSegmentVisitor() {}1134 SimpleSegmentVisitor.prototype = {1135 onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {1136 this.currentPageInfo = info;1137 var rowSize = info.width + 7 >> 3;1138 var buffer = new Uint8ClampedArray(rowSize * info.height);1139 if (info.defaultPixelValue) {1140 for (var i = 0, ii = buffer.length; i < ii; i++) {1141 buffer[i] = 0xFF;1142 }1143 }1144 this.buffer = buffer;1145 },1146 drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {1147 var pageInfo = this.currentPageInfo;1148 var width = regionInfo.width,1149 height = regionInfo.height;1150 var rowSize = pageInfo.width + 7 >> 3;1151 var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;1152 var buffer = this.buffer;1153 var mask0 = 128 >> (regionInfo.x & 7);1154 var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);1155 var i, j, mask, offset;1156 switch (combinationOperator) {1157 case 0:1158 for (i = 0; i < height; i++) {1159 mask = mask0;1160 offset = offset0;1161 for (j = 0; j < width; j++) {1162 if (bitmap[i][j]) {1163 buffer[offset] |= mask;1164 }1165 mask >>= 1;1166 if (!mask) {1167 mask = 128;1168 offset++;1169 }1170 }1171 offset0 += rowSize;1172 }1173 break;1174 case 2:1175 for (i = 0; i < height; i++) {1176 mask = mask0;1177 offset = offset0;1178 for (j = 0; j < width; j++) {1179 if (bitmap[i][j]) {1180 buffer[offset] ^= mask;1181 }1182 mask >>= 1;1183 if (!mask) {1184 mask = 128;1185 offset++;1186 }1187 }1188 offset0 += rowSize;1189 }1190 break;1191 default:1192 throw new Jbig2Error('operator ' + combinationOperator + ' is not supported');1193 }1194 },1195 onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {1196 var regionInfo = region.info;1197 var decodingContext = new DecodingContext(data, start, end);1198 var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);1199 this.drawBitmap(regionInfo, bitmap);1200 },1201 onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {1202 this.onImmediateGenericRegion.apply(this, arguments);1203 },1204 onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {1205 var huffmanTables;1206 if (dictionary.huffman) {1207 throw new Jbig2Error('huffman is not supported');1208 }1209 var symbols = this.symbols;1210 if (!symbols) {1211 this.symbols = symbols = {};1212 }1213 var inputSymbols = [];1214 for (var i = 0, ii = referredSegments.length; i < ii; i++) {1215 inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);1216 }1217 var decodingContext = new DecodingContext(data, start, end);1218 symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);1219 },1220 onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {1221 var regionInfo = region.info;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2console.log(wptools.Jbig2Error());3var wptools = require('wptools');4console.log(wptools.Jbig2Error());5var wptools = require('wptools');6console.log(wptools.Jbig2Error());7var wptools = require('wptools');8console.log(wptools.Jbig2Error());9var wptools = require('wptools');10console.log(wptools.Jbig2Error());11var wptools = require('wptools');12console.log(wptools.Jbig2Error());13var wptools = require('wptools');14console.log(wptools.Jbig2Error());15var wptools = require('wptools');16console.log(wptools.Jbig2Error());17var wptools = require('wptools');18console.log(wptools.Jbig2Error());19var wptools = require('wptools');20console.log(wptools.Jbig2Error());21var wptools = require('wptools');22console.log(wptools.Jbig2Error());23var wptools = require('wptools');24console.log(wptools.Jbig2Error());

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.Jbig2Error('test error');3var wptools = require('wptools');4wptools.Jbig2Error('test error');5var wptools = require('wptools');6wptools.Jbig2Error('test error');7var wptools = require('wptools');8wptools.Jbig2Error('test error');9var wptools = require('wptools');10wptools.Jbig2Error('test error');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.Jbig2Error('test error');3var wptools = require('wptools');4wptools.Jbig2Error('test error');5var wptools = require('wptools');6wptools.Jbig2Error('test error');7var wptools = require('wptools');8wptools.Jbig2Error('test error');9var wptools = require('wptools');10wptools.Jbig2Error('test error');11var wptools = require('wptools');12wptools.Jbig2Error('test error');13var wptools = require('wptools');14wptools.Jbig2Error('test error');15var wptools = require('wptools');16wptools.Jbig2Error('test error');17var wptools = require('wptools');18wptools.Jbig2Error('test error');19var wptools = require('wptools');20wptools.Jbig2Error('test error');21var wptools = require('wptools');22wptools.Jbig2Error('test error');23var wptools = require('wptools');24wptools.Jbig2Error('test error');25var wptools = require('wptools');26wptools.Jbig2Error('test error');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var error = wptools.Jbig2Error;3console.log(error);4var wptools = require('wptools');5var error = wptools.Jbig2Error();6console.log(error);7var wptools = require('wptools');8var error = wptools.Jbig2Error;9console.log(error);10var wptools = require('wptools');11var error = wptools.Jbig2Error();12console.log(error);13var wptools = require('wptools');14var error = wptools.Jbig2Error;15console.log(error);16var wptools = require('wptools');17var error = wptools.Jbig2Error();18console.log(error);19var wptools = require('wptools');20var error = wptools.Jbig2Error;21console.log(error);22var wptools = require('wptools');23var error = wptools.Jbig2Error();24console.log(error);25var wptools = require('wptools');26var error = wptools.Jbig2Error;27console.log(error);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Jbig2Error } = require('wptools');2const error = new Jbig2Error('test error');3console.log(error.message);4console.log(error.name);5const { Jbig2Error } = require('wptools');6const error = new Jbig2Error('test error');7console.log(error.message);8console.log(error.name);9console.log(error.stack);10const { Jbig2Error } = require('wptools');11const error = new Jbig2Error('test error');12console.log(error.message);13console.log(error.name);14console.log(error.stack);15console.log(error.toString());16const { Jbig2Error } = require('wptools');17const error = new Jbig2Error('test error');18console.log(error.message);19console.log(error.name);20console.log(error.stack);21console.log(error.toString());22console.log(error.toMessage());23const { Jbig2Error } = require('wptools');24const error = new Jbig2Error('test error');25console.log(error.message);26console.log(error.name);27console.log(error.stack);28console.log(error.toString());29console.log(error.toMessage());30console.log(error.toLog());31const { Jbig2Error } = require('wptools');32const error = new Jbig2Error('test error');33console.log(error.message);34console.log(error.name);35console.log(error.stack);36console.log(error.toString());37console.log(error.toMessage());38console.log(error.toLog());39console.log(error.toConsole());40const { Jbig2Error } = require('wptools');41const error = new Jbig2Error('test error');42console.log(error.message);43console.log(error.name);44console.log(error.stack);45console.log(error.toString());46console.log(error.toMessage());47console.log(error.toLog());48console.log(error.toConsole());49console.log(error.toFile());

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var page = wptools.page('Barack Obama');3page.get(function(err, resp) {4 console.log(resp);5});6var wptools = require('wptools');7var page = wptools.page('Barack Obama');8page.get(function(err, resp) {9 console.log(resp);10});11var wptools = require('wptools');12var page = wptools.page('Barack Obama');13page.get(function(err, resp) {14 console.log(resp);15});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var wp = new wptools();3wp.Jbig2Error("Test Error Message");4var wptools = require('wptools');5var wp = new wptools();6wp.Jbig2Error("Test Error Message");7var wptools = require('wptools');8var wp = new wptools();9wp.Jbig2Error("Test Error Message");10var wptools = require('wptools');11var wp = new wptools();12wp.Jbig2Error("Test Error Message");13var wptools = require('wptools');14var wp = new wptools();15wp.Jbig2Error("Test Error Message");16var wptools = require('wptools');17var wp = new wptools();18wp.Jbig2Error("Test Error Message");19var wptools = require('wptools');20var wp = new wptools();21wp.Jbig2Error("Test Error Message");22var wptools = require('wptools');23var wp = new wptools();24wp.Jbig2Error("Test Error Message");25var wptools = require('wptools');26var wp = new wptools();27wp.Jbig2Error("Test Error Message");28var wptools = require('wptools');29var wp = new wptools();30wp.Jbig2Error("Test Error Message");31var wptools = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.Jbig2Error("test");3wptools.Jbig2Error("test");4at Object. (/home/abhijit/Downloads/node-wptools-master/test.js:3:1)5at Module._compile (module.js:456:26)6at Object.Module._extensions..js (module.js:474:10)7at Module.load (module.js:356:32)8at Function.Module._load (module.js:312:12)9at Function.Module.runMain (module.js:497:10)10at startup (node.js:119:16)11var wptools = require('wptools');12wptools.Jbig2Error("test");13wptools.Jbig2Error("test");14at Object. (/home/abhijit/Downloads/node-wptools-master/test.js:3:

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful