@4tw/vue-cli-plugin-pdfjs-viewer 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/assets/build/pdf.mjs +973 -220
  3. package/assets/build/pdf.mjs.map +1 -1
  4. package/assets/build/pdf.sandbox.mjs +3 -3
  5. package/assets/build/pdf.sandbox.mjs.map +1 -1
  6. package/assets/build/pdf.worker.mjs +66 -19
  7. package/assets/build/pdf.worker.mjs.map +1 -1
  8. package/assets/web/images/toolbarButton-editorHighlight.svg +6 -0
  9. package/assets/web/locale/be/viewer.ftl +35 -0
  10. package/assets/web/locale/br/viewer.ftl +30 -0
  11. package/assets/web/locale/cs/viewer.ftl +35 -0
  12. package/assets/web/locale/cy/viewer.ftl +33 -0
  13. package/assets/web/locale/da/viewer.ftl +14 -0
  14. package/assets/web/locale/de/viewer.ftl +35 -0
  15. package/assets/web/locale/dsb/viewer.ftl +33 -0
  16. package/assets/web/locale/el/viewer.ftl +33 -0
  17. package/assets/web/locale/en-GB/viewer.ftl +33 -0
  18. package/assets/web/locale/en-US/viewer.ftl +36 -2
  19. package/assets/web/locale/es-AR/viewer.ftl +35 -0
  20. package/assets/web/locale/es-CL/viewer.ftl +33 -0
  21. package/assets/web/locale/es-ES/viewer.ftl +35 -0
  22. package/assets/web/locale/fi/viewer.ftl +33 -0
  23. package/assets/web/locale/fr/viewer.ftl +33 -0
  24. package/assets/web/locale/fur/viewer.ftl +14 -0
  25. package/assets/web/locale/fy-NL/viewer.ftl +35 -0
  26. package/assets/web/locale/gn/viewer.ftl +33 -0
  27. package/assets/web/locale/he/viewer.ftl +33 -0
  28. package/assets/web/locale/hsb/viewer.ftl +33 -0
  29. package/assets/web/locale/hu/viewer.ftl +35 -0
  30. package/assets/web/locale/ia/viewer.ftl +33 -0
  31. package/assets/web/locale/is/viewer.ftl +33 -0
  32. package/assets/web/locale/it/viewer.ftl +33 -0
  33. package/assets/web/locale/ja/viewer.ftl +14 -0
  34. package/assets/web/locale/ka/viewer.ftl +2 -0
  35. package/assets/web/locale/kab/viewer.ftl +12 -0
  36. package/assets/web/locale/kk/viewer.ftl +33 -0
  37. package/assets/web/locale/ko/viewer.ftl +33 -0
  38. package/assets/web/locale/nb-NO/viewer.ftl +33 -0
  39. package/assets/web/locale/nl/viewer.ftl +35 -0
  40. package/assets/web/locale/nn-NO/viewer.ftl +2 -0
  41. package/assets/web/locale/pa-IN/viewer.ftl +14 -0
  42. package/assets/web/locale/pl/viewer.ftl +35 -0
  43. package/assets/web/locale/pt-BR/viewer.ftl +33 -0
  44. package/assets/web/locale/rm/viewer.ftl +35 -0
  45. package/assets/web/locale/ru/viewer.ftl +33 -0
  46. package/assets/web/locale/sk/viewer.ftl +33 -0
  47. package/assets/web/locale/sl/viewer.ftl +35 -0
  48. package/assets/web/locale/sq/viewer.ftl +35 -0
  49. package/assets/web/locale/sv-SE/viewer.ftl +33 -0
  50. package/assets/web/locale/tg/viewer.ftl +35 -0
  51. package/assets/web/locale/tr/viewer.ftl +33 -0
  52. package/assets/web/locale/uk/viewer.ftl +35 -0
  53. package/assets/web/locale/vi/viewer.ftl +33 -0
  54. package/assets/web/locale/zh-CN/viewer.ftl +35 -0
  55. package/assets/web/locale/zh-TW/viewer.ftl +33 -0
  56. package/assets/web/viewer.css +524 -360
  57. package/assets/web/viewer.html +22 -11
  58. package/assets/web/viewer.mjs +343 -238
  59. package/assets/web/viewer.mjs.map +1 -1
  60. package/package.json +1 -1
@@ -90,7 +90,9 @@ const AnnotationEditorParamsType = {
90
90
  FREETEXT_OPACITY: 13,
91
91
  INK_COLOR: 21,
92
92
  INK_THICKNESS: 22,
93
- INK_OPACITY: 23
93
+ INK_OPACITY: 23,
94
+ HIGHLIGHT_COLOR: 31,
95
+ HIGHLIGHT_DEFAULT_COLOR: 32
94
96
  };
95
97
  const PermissionFlag = {
96
98
  PRINT: 0x04,
@@ -3996,6 +3998,10 @@ class FlateStream extends DecodeStream {
3996
3998
  }
3997
3999
  return [codes, maxLen];
3998
4000
  }
4001
+ #endsStreamOnError(err) {
4002
+ info(err);
4003
+ this.eof = true;
4004
+ }
3999
4005
  readBlock() {
4000
4006
  let buffer, len;
4001
4007
  const str = this.str;
@@ -4007,19 +4013,23 @@ class FlateStream extends DecodeStream {
4007
4013
  if (hdr === 0) {
4008
4014
  let b;
4009
4015
  if ((b = str.getByte()) === -1) {
4010
- throw new FormatError("Bad block header in flate stream");
4016
+ this.#endsStreamOnError("Bad block header in flate stream");
4017
+ return;
4011
4018
  }
4012
4019
  let blockLen = b;
4013
4020
  if ((b = str.getByte()) === -1) {
4014
- throw new FormatError("Bad block header in flate stream");
4021
+ this.#endsStreamOnError("Bad block header in flate stream");
4022
+ return;
4015
4023
  }
4016
4024
  blockLen |= b << 8;
4017
4025
  if ((b = str.getByte()) === -1) {
4018
- throw new FormatError("Bad block header in flate stream");
4026
+ this.#endsStreamOnError("Bad block header in flate stream");
4027
+ return;
4019
4028
  }
4020
4029
  let check = b;
4021
4030
  if ((b = str.getByte()) === -1) {
4022
- throw new FormatError("Bad block header in flate stream");
4031
+ this.#endsStreamOnError("Bad block header in flate stream");
4032
+ return;
4023
4033
  }
4024
4034
  check |= b << 8;
4025
4035
  if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
@@ -29281,6 +29291,9 @@ function generateFont({
29281
29291
  return result;
29282
29292
  }
29283
29293
  function getFontSubstitution(systemFontCache, idFactory, localFontPath, baseFontName, standardFontName) {
29294
+ if (baseFontName.startsWith("InvalidPDFjsFont_")) {
29295
+ return null;
29296
+ }
29284
29297
  baseFontName = normalizeFontName(baseFontName);
29285
29298
  const key = baseFontName;
29286
29299
  let substitutionInfo = systemFontCache.get(key);
@@ -31422,6 +31435,7 @@ class PartialEvaluator {
31422
31435
  }
31423
31436
  const objId = `mask_${this.idFactory.createObjId()}`;
31424
31437
  operatorList.addDependency(objId);
31438
+ imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
31425
31439
  this._sendImgData(objId, imgData);
31426
31440
  args = [{
31427
31441
  data: objId,
@@ -31463,14 +31477,32 @@ class PartialEvaluator {
31463
31477
  cacheGlobally = false;
31464
31478
  if (this.parsingType3Font) {
31465
31479
  objId = `${this.idFactory.getDocId()}_type3_${objId}`;
31466
- } else if (imageRef) {
31480
+ } else if (cacheKey && imageRef) {
31467
31481
  cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
31468
31482
  if (cacheGlobally) {
31483
+ assert(!isInline, "Cannot cache an inline image globally.");
31469
31484
  objId = `${this.idFactory.getDocId()}_${objId}`;
31470
31485
  }
31471
31486
  }
31472
31487
  operatorList.addDependency(objId);
31473
31488
  args = [objId, w, h];
31489
+ operatorList.addImageOps(OPS.paintImageXObject, args, optionalContent);
31490
+ if (cacheGlobally && w * h > 250000) {
31491
+ const localLength = await this.handler.sendWithPromise("commonobj", [objId, "CopyLocalImage", {
31492
+ imageRef
31493
+ }]);
31494
+ if (localLength) {
31495
+ this.globalImageCache.setData(imageRef, {
31496
+ objId,
31497
+ fn: OPS.paintImageXObject,
31498
+ args,
31499
+ optionalContent,
31500
+ byteSize: 0
31501
+ });
31502
+ this.globalImageCache.addByteSize(imageRef, localLength);
31503
+ return;
31504
+ }
31505
+ }
31474
31506
  PDFImage.buildImage({
31475
31507
  xref: this.xref,
31476
31508
  res: resources,
@@ -31480,16 +31512,16 @@ class PartialEvaluator {
31480
31512
  localColorSpaceCache
31481
31513
  }).then(async imageObj => {
31482
31514
  imgData = await imageObj.createImageData(false, this.options.isOffscreenCanvasSupported);
31483
- if (cacheKey && imageRef && cacheGlobally) {
31484
- const length = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
31485
- this.globalImageCache.addByteSize(imageRef, length);
31515
+ imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
31516
+ imgData.ref = imageRef;
31517
+ if (cacheGlobally) {
31518
+ this.globalImageCache.addByteSize(imageRef, imgData.dataLen);
31486
31519
  }
31487
31520
  return this._sendImgData(objId, imgData, cacheGlobally);
31488
31521
  }).catch(reason => {
31489
31522
  warn(`Unable to decode image "${objId}": "${reason}".`);
31490
31523
  return this._sendImgData(objId, null, cacheGlobally);
31491
31524
  });
31492
- operatorList.addImageOps(OPS.paintImageXObject, args, optionalContent);
31493
31525
  if (cacheKey) {
31494
31526
  const cacheData = {
31495
31527
  fn: OPS.paintImageXObject,
@@ -31500,7 +31532,6 @@ class PartialEvaluator {
31500
31532
  if (imageRef) {
31501
31533
  this._regionalImageCache.set(null, imageRef, cacheData);
31502
31534
  if (cacheGlobally) {
31503
- assert(!isInline, "Cannot cache an inline image globally.");
31504
31535
  this.globalImageCache.setData(imageRef, {
31505
31536
  objId,
31506
31537
  fn: OPS.paintImageXObject,
@@ -50995,11 +51026,13 @@ class Annotation {
50995
51026
  }
50996
51027
  if (borderStyle.has("BS")) {
50997
51028
  const dict = borderStyle.get("BS");
50998
- const dictType = dict.get("Type");
50999
- if (!dictType || isName(dictType, "Border")) {
51000
- this.borderStyle.setWidth(dict.get("W"), this.rectangle);
51001
- this.borderStyle.setStyle(dict.get("S"));
51002
- this.borderStyle.setDashArray(dict.getArray("D"));
51029
+ if (dict instanceof Dict) {
51030
+ const dictType = dict.get("Type");
51031
+ if (!dictType || isName(dictType, "Border")) {
51032
+ this.borderStyle.setWidth(dict.get("W"), this.rectangle);
51033
+ this.borderStyle.setStyle(dict.get("S"));
51034
+ this.borderStyle.setDashArray(dict.getArray("D"));
51035
+ }
51003
51036
  }
51004
51037
  } else if (borderStyle.has("Border")) {
51005
51038
  const array = borderStyle.getArray("Border");
@@ -53770,6 +53803,7 @@ class XRef {
53770
53803
  this._pendingRefs = new RefSet();
53771
53804
  this._newPersistentRefNum = null;
53772
53805
  this._newTemporaryRefNum = null;
53806
+ this._persistentRefsCache = null;
53773
53807
  }
53774
53808
  getNewPersistentRef(obj) {
53775
53809
  if (this._newPersistentRefNum === null) {
@@ -53782,11 +53816,24 @@ class XRef {
53782
53816
  getNewTemporaryRef() {
53783
53817
  if (this._newTemporaryRefNum === null) {
53784
53818
  this._newTemporaryRefNum = this.entries.length || 1;
53819
+ if (this._newPersistentRefNum) {
53820
+ this._persistentRefsCache = new Map();
53821
+ for (let i = this._newTemporaryRefNum; i < this._newPersistentRefNum; i++) {
53822
+ this._persistentRefsCache.set(i, this._cacheMap.get(i));
53823
+ this._cacheMap.delete(i);
53824
+ }
53825
+ }
53785
53826
  }
53786
53827
  return Ref.get(this._newTemporaryRefNum++, 0);
53787
53828
  }
53788
53829
  resetNewTemporaryRef() {
53789
53830
  this._newTemporaryRefNum = null;
53831
+ if (this._persistentRefsCache) {
53832
+ for (const [num, obj] of this._persistentRefsCache) {
53833
+ this._cacheMap.set(num, obj);
53834
+ }
53835
+ }
53836
+ this._persistentRefsCache = null;
53790
53837
  }
53791
53838
  setStartXRef(startXRef) {
53792
53839
  this.startXRefQueue = [startXRef];
@@ -56547,7 +56594,7 @@ class WorkerMessageHandler {
56547
56594
  docId,
56548
56595
  apiVersion
56549
56596
  } = docParams;
56550
- const workerVersion = '4.0.269';
56597
+ const workerVersion = '4.0.379';
56551
56598
  if (apiVersion !== workerVersion) {
56552
56599
  throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
56553
56600
  }
@@ -57115,8 +57162,8 @@ if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" &&
57115
57162
 
57116
57163
  ;// CONCATENATED MODULE: ./src/pdf.worker.js
57117
57164
 
57118
- const pdfjsVersion = '4.0.269';
57119
- const pdfjsBuild = 'f4b396f6c';
57165
+ const pdfjsVersion = '4.0.379';
57166
+ const pdfjsBuild = '9e14d04fd';
57120
57167
 
57121
57168
  var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
57122
57169
  export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };