@chialab/pdfjs-lib 1.0.0-alpha.12 → 1.0.0-alpha.14

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.
@@ -25468,6 +25468,13 @@ function colorToRgb(color) {
25468
25468
  }
25469
25469
  throw new Error(`Invalid color format: ${color}`);
25470
25470
  }
25471
+ function rgbToHex(r, g, b) {
25472
+ const toHex = (value) => value.toString(16).padStart(2, "0");
25473
+ if (Array.isArray(r)) {
25474
+ return `#${toHex(r[0])}${toHex(r[1])}${toHex(r[2])}`;
25475
+ }
25476
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
25477
+ }
25471
25478
 
25472
25479
  // src/lib/PDFPageProxy.ts
25473
25480
  var getAnnotations = PDFPageProxy.prototype.getAnnotations;
@@ -26369,6 +26376,7 @@ export {
26369
26376
  makeSerializable,
26370
26377
  noContextMenu,
26371
26378
  normalizeUnicode,
26379
+ rgbToHex,
26372
26380
  setLayerDimensions,
26373
26381
  shadow,
26374
26382
  stopEvent,
@@ -1,12 +1,12 @@
1
1
  import type { SvgRoot } from './SvgCanvasContext';
2
- type Rect = [number, number, number, number];
3
- type Color = [number, number, number];
4
- type Dir = 'ltr' | 'rtl';
5
- declare enum BorderStyle {
2
+ export type Rect = [number, number, number, number];
3
+ export type Color = [number, number, number];
4
+ export type Dir = 'ltr' | 'rtl';
5
+ export declare enum BorderStyle {
6
6
  SOLID = 1,
7
7
  DASHED = 2
8
8
  }
9
- declare enum LineEnding {
9
+ export declare enum LineEnding {
10
10
  NONE = "None",
11
11
  SQUARE = "Square",
12
12
  CIRCLE = "Circle",
@@ -202,4 +202,3 @@ export declare function isTrapNetAnnotation(annotation: AnnotationData): annotat
202
202
  export declare function isWatermarkAnnotation(annotation: AnnotationData): annotation is WatermarkAnnotationData;
203
203
  export declare function isThreeDAnnotation(annotation: AnnotationData): annotation is ThreeDAnnotationData;
204
204
  export declare function isRedactAnnotation(annotation: AnnotationData): annotation is RedactAnnotationData;
205
- export {};
@@ -24,4 +24,6 @@ export declare function makeSerializable<T>(object: T): T;
24
24
  * @param color The color in hex format (e.g., '#ff0000' or '#f00').
25
25
  * @returns An array of RGB values [r, g, b].
26
26
  */
27
- export declare function colorToRgb(color: string): number[];
27
+ export declare function colorToRgb(color: string): [number, number, number];
28
+ export declare function rgbToHex(rgb: [number, number, number]): string;
29
+ export declare function rgbToHex(r: number, g: number, b: number): string;
@@ -6882,8 +6882,330 @@ var NodeWasmFactory = class extends BaseWasmFactory {
6882
6882
  }
6883
6883
  };
6884
6884
 
6885
- // src/lib/NodeUtils.ts
6885
+ // src/lib/utils.ts
6886
+ async function canvasToData(canvas) {
6887
+ if ("toBlob" in canvas) {
6888
+ const blob = await new Promise(
6889
+ (resolve) => canvas.toBlob((data) => resolve(data))
6890
+ );
6891
+ if (!blob) {
6892
+ throw new Error("Failed to generate graphics");
6893
+ }
6894
+ return new Uint8Array(await blob.arrayBuffer());
6895
+ }
6896
+ const buffer = await canvas.encode("png");
6897
+ return new Uint8Array(buffer);
6898
+ }
6899
+ async function toDataUrl(data, type = "image/png") {
6900
+ if (typeof FileReader !== "undefined") {
6901
+ return new Promise((resolve) => {
6902
+ const reader = new FileReader();
6903
+ reader.onload = () => {
6904
+ resolve(reader.result);
6905
+ };
6906
+ reader.readAsDataURL(new Blob([data], { type }));
6907
+ });
6908
+ }
6909
+ return `data:${type};base64,${Buffer.from(data).toString("base64")}`;
6910
+ }
6911
+ function makeSerializable(object) {
6912
+ if (typeof object !== "object" || object === null) {
6913
+ return object;
6914
+ }
6915
+ if (object instanceof Int8Array || object instanceof Uint8Array || object instanceof Uint8ClampedArray || object instanceof Int16Array || object instanceof Uint16Array || object instanceof Int32Array || object instanceof Uint32Array || object instanceof Float32Array || object instanceof Float64Array) {
6916
+ return makeSerializable(Array.from(object));
6917
+ }
6918
+ if (object instanceof BigInt64Array || object instanceof BigUint64Array) {
6919
+ return makeSerializable(Array.from(object));
6920
+ }
6921
+ if (Array.isArray(object)) {
6922
+ return object.map(makeSerializable);
6923
+ }
6924
+ return Object.fromEntries(
6925
+ Object.entries(object).map(([key, value]) => [
6926
+ key,
6927
+ makeSerializable(value)
6928
+ ])
6929
+ );
6930
+ }
6931
+ function colorToRgb(color) {
6932
+ if (color.startsWith("#")) {
6933
+ const hex = color.slice(1);
6934
+ if (hex.length === 3) {
6935
+ return [
6936
+ Number.parseInt(hex[0] + hex[0], 16),
6937
+ Number.parseInt(hex[1] + hex[1], 16),
6938
+ Number.parseInt(hex[2] + hex[2], 16)
6939
+ ];
6940
+ }
6941
+ if (hex.length === 6) {
6942
+ return [
6943
+ Number.parseInt(hex.slice(0, 2), 16),
6944
+ Number.parseInt(hex.slice(2, 4), 16),
6945
+ Number.parseInt(hex.slice(4, 6), 16)
6946
+ ];
6947
+ }
6948
+ }
6949
+ throw new Error(`Invalid color format: ${color}`);
6950
+ }
6951
+ function rgbToHex(r, g, b) {
6952
+ const toHex = (value) => value.toString(16).padStart(2, "0");
6953
+ if (Array.isArray(r)) {
6954
+ return `#${toHex(r[0])}${toHex(r[1])}${toHex(r[2])}`;
6955
+ }
6956
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
6957
+ }
6958
+
6959
+ // src/lib/NodeFilterFactory.ts
6886
6960
  var filtersRegistry = /* @__PURE__ */ new Map();
6961
+ function createTables(maps) {
6962
+ if (maps.length === 1) {
6963
+ const mapR2 = maps[0];
6964
+ const buffer = new Array(256);
6965
+ for (let i = 0; i < 256; i++) {
6966
+ buffer[i] = mapR2[i] / 255;
6967
+ }
6968
+ return [buffer, buffer, buffer];
6969
+ }
6970
+ const [mapR, mapG, mapB] = maps;
6971
+ const bufferR = new Array(256);
6972
+ const bufferG = new Array(256);
6973
+ const bufferB = new Array(256);
6974
+ for (let i = 0; i < 256; i++) {
6975
+ bufferR[i] = mapR[i] / 255;
6976
+ bufferG[i] = mapG[i] / 255;
6977
+ bufferB[i] = mapB[i] / 255;
6978
+ }
6979
+ return [bufferR, bufferG, bufferB];
6980
+ }
6981
+ function createTransferMapAlphaConversion(aTable) {
6982
+ return (ctx) => {
6983
+ const imageData = ctx.getImageData(
6984
+ 0,
6985
+ 0,
6986
+ ctx.canvas.width,
6987
+ ctx.canvas.height
6988
+ );
6989
+ const data = imageData.data;
6990
+ const tableSize = aTable.length;
6991
+ for (let i = 0; i < data.length; i += 4) {
6992
+ const alpha = data[i + 3] / 255;
6993
+ const index = alpha * (tableSize - 1);
6994
+ const lower = Math.floor(index);
6995
+ const upper = Math.min(lower + 1, tableSize - 1);
6996
+ const t = index - lower;
6997
+ const newAlpha = (1 - t) * aTable[lower] + t * aTable[upper];
6998
+ data[i + 3] = newAlpha * 255;
6999
+ }
7000
+ ctx.putImageData(imageData, 0, 0);
7001
+ };
7002
+ }
7003
+ function createTransferMapConversion(rTable, gTable, bTable) {
7004
+ return (ctx) => {
7005
+ const imageData = ctx.getImageData(
7006
+ 0,
7007
+ 0,
7008
+ ctx.canvas.width,
7009
+ ctx.canvas.height
7010
+ );
7011
+ const data = imageData.data;
7012
+ const rSize = rTable.length;
7013
+ const gSize = gTable.length;
7014
+ const bSize = bTable.length;
7015
+ for (let i = 0; i < data.length; i += 4) {
7016
+ const r = data[i] / 255;
7017
+ const g = data[i + 1] / 255;
7018
+ const b = data[i + 2] / 255;
7019
+ const rIndex = r * (rSize - 1);
7020
+ const rLower = Math.floor(rIndex);
7021
+ const rUpper = Math.min(rLower + 1, rSize - 1);
7022
+ const rT = rIndex - rLower;
7023
+ const newR = (1 - rT) * rTable[rLower] + rT * rTable[rUpper];
7024
+ const gIndex = g * (gSize - 1);
7025
+ const gLower = Math.floor(gIndex);
7026
+ const gUpper = Math.min(gLower + 1, gSize - 1);
7027
+ const gT = gIndex - gLower;
7028
+ const newG = (1 - gT) * gTable[gLower] + gT * gTable[gUpper];
7029
+ const bIndex = b * (bSize - 1);
7030
+ const bLower = Math.floor(bIndex);
7031
+ const bUpper = Math.min(bLower + 1, bSize - 1);
7032
+ const bT = bIndex - bLower;
7033
+ const newB = (1 - bT) * bTable[bLower] + bT * bTable[bUpper];
7034
+ data[i] = newR * 255;
7035
+ data[i + 1] = newG * 255;
7036
+ data[i + 2] = newB * 255;
7037
+ }
7038
+ ctx.putImageData(imageData, 0, 0);
7039
+ };
7040
+ }
7041
+ function createLuminosityConversion() {
7042
+ return (ctx) => {
7043
+ const imageData = ctx.getImageData(
7044
+ 0,
7045
+ 0,
7046
+ ctx.canvas.width,
7047
+ ctx.canvas.height
7048
+ );
7049
+ const data = imageData.data;
7050
+ for (let i = 0; i < data.length; i += 4) {
7051
+ const r = data[i];
7052
+ const g = data[i + 1];
7053
+ const b = data[i + 2];
7054
+ data[i] = data[i + 1] = data[i + 2] = 0;
7055
+ data[i + 3] = r * 0.3 + g * 0.59 + b * 0.11;
7056
+ }
7057
+ ctx.putImageData(imageData, 0, 0);
7058
+ };
7059
+ }
7060
+ function createGrayConversion() {
7061
+ return (ctx) => {
7062
+ const imageData = ctx.getImageData(
7063
+ 0,
7064
+ 0,
7065
+ ctx.canvas.width,
7066
+ ctx.canvas.height
7067
+ );
7068
+ const data = imageData.data;
7069
+ for (let i = 0; i < data.length; i += 4) {
7070
+ const r = data[i];
7071
+ const g = data[i + 1];
7072
+ const b = data[i + 2];
7073
+ const gray = r * 0.2126 + g * 0.7152 + b * 0.0722;
7074
+ data[i] = data[i + 1] = data[i + 2] = gray;
7075
+ }
7076
+ ctx.putImageData(imageData, 0, 0);
7077
+ };
7078
+ }
7079
+ var NodeFilterFactory2 = class extends NodeFilterFactory {
7080
+ addFilter(maps) {
7081
+ if (!maps) {
7082
+ return "none";
7083
+ }
7084
+ const [rTable, gTable, bTable] = createTables(maps);
7085
+ const url = `url(#filter_${maps.length === 1 ? rTable.join("_") : `${rTable.join("_")}_${gTable.join("_")}_${bTable.join("_")}`})`;
7086
+ if (!filtersRegistry.has(url)) {
7087
+ filtersRegistry.set(
7088
+ url,
7089
+ createTransferMapConversion(rTable, gTable, bTable)
7090
+ );
7091
+ }
7092
+ return url;
7093
+ }
7094
+ addHCMFilter(fgColor, bgColor) {
7095
+ const fgRGB = colorToRgb(fgColor);
7096
+ const bgRGB = colorToRgb(bgColor);
7097
+ const url = `url(#hcm_${rgbToHex(fgRGB)}_${rgbToHex(bgRGB)})`;
7098
+ if (!filtersRegistry.has(url)) {
7099
+ const table = new Array(256);
7100
+ for (let i = 0; i <= 255; i++) {
7101
+ const x = i / 255;
7102
+ table[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
7103
+ }
7104
+ const transferMapFilter = createTransferMapConversion(
7105
+ table,
7106
+ table,
7107
+ table
7108
+ );
7109
+ const grayFilter = createGrayConversion();
7110
+ const getSteps = (c, n) => {
7111
+ const start = fgRGB[c] / 255;
7112
+ const end = bgRGB[c] / 255;
7113
+ const arr = new Array(n + 1);
7114
+ for (let i = 0; i <= n; i++) {
7115
+ arr[i] = start + i / n * (end - start);
7116
+ }
7117
+ return arr;
7118
+ };
7119
+ const finalTransferMap = createTransferMapConversion(
7120
+ getSteps(0, 5),
7121
+ getSteps(1, 5),
7122
+ getSteps(2, 5)
7123
+ );
7124
+ filtersRegistry.set(url, (ctx) => {
7125
+ transferMapFilter(ctx);
7126
+ grayFilter(ctx);
7127
+ finalTransferMap(ctx);
7128
+ });
7129
+ }
7130
+ return url;
7131
+ }
7132
+ addAlphaFilter(map) {
7133
+ const [tableA] = createTables([map]);
7134
+ const url = `url(#alpha_${tableA.join("_")})`;
7135
+ if (!filtersRegistry.has(url)) {
7136
+ filtersRegistry.set(url, createTransferMapAlphaConversion(map));
7137
+ }
7138
+ return url;
7139
+ }
7140
+ addLuminosityFilter(map) {
7141
+ const url = `url(#luminosity${map ? `_${map.join("_")}` : ""})`;
7142
+ if (!filtersRegistry.has(url)) {
7143
+ const tables = map ? createTables([map]) : null;
7144
+ const alphaFilter = tables ? createTransferMapAlphaConversion(tables[0]) : null;
7145
+ const luminosityFilter = createLuminosityConversion();
7146
+ filtersRegistry.set(url, (ctx) => {
7147
+ luminosityFilter(ctx);
7148
+ alphaFilter?.(ctx);
7149
+ });
7150
+ }
7151
+ return url;
7152
+ }
7153
+ addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
7154
+ const fgRGB = colorToRgb(fgColor);
7155
+ const bgRGB = colorToRgb(bgColor);
7156
+ let newFgRGB = colorToRgb(newFgColor);
7157
+ let newBgRGB = colorToRgb(newBgColor);
7158
+ const url = `url(#highlight_hcm_${filterName}_${rgbToHex(fgRGB)}_${rgbToHex(bgRGB)}_${rgbToHex(newFgRGB)}_${rgbToHex(newBgRGB)})`;
7159
+ if (!filtersRegistry.has(url)) {
7160
+ let fgGray = Math.round(
7161
+ 0.2126 * fgRGB[0] + 0.7152 * fgRGB[1] + 0.0722 * fgRGB[2]
7162
+ );
7163
+ let bgGray = Math.round(
7164
+ 0.2126 * bgRGB[0] + 0.7152 * bgRGB[1] + 0.0722 * bgRGB[2]
7165
+ );
7166
+ if (bgGray < fgGray) {
7167
+ [fgGray, bgGray, newFgRGB, newBgRGB] = [
7168
+ bgGray,
7169
+ fgGray,
7170
+ newBgRGB,
7171
+ newFgRGB
7172
+ ];
7173
+ }
7174
+ const grayFilter = createGrayConversion();
7175
+ const getSteps = (fg, bg, n) => {
7176
+ const arr = new Array(256);
7177
+ const step = (bgGray - fgGray) / n;
7178
+ const newStart = fg / 255;
7179
+ const newStep = (bg - fg) / (255 * n);
7180
+ let prev = 0;
7181
+ for (let i = 0; i <= n; i++) {
7182
+ const k = Math.round(fgGray + i * step);
7183
+ const value = newStart + i * newStep;
7184
+ for (let j = prev; j <= k; j++) {
7185
+ arr[j] = value;
7186
+ }
7187
+ prev = k + 1;
7188
+ }
7189
+ for (let i = prev; i < 256; i++) {
7190
+ arr[i] = arr[prev - 1];
7191
+ }
7192
+ return arr;
7193
+ };
7194
+ const transferMapFilter = createTransferMapConversion(
7195
+ getSteps(newFgRGB[0], newBgRGB[0], 5),
7196
+ getSteps(newFgRGB[1], newBgRGB[1], 5),
7197
+ getSteps(newFgRGB[2], newBgRGB[2], 5)
7198
+ );
7199
+ filtersRegistry.set(url, (ctx) => {
7200
+ grayFilter(ctx);
7201
+ transferMapFilter(ctx);
7202
+ });
7203
+ }
7204
+ return url;
7205
+ }
7206
+ };
7207
+
7208
+ // src/lib/NodeCanvasFactory.ts
6887
7209
  var NodeCanvasFactory2 = class extends NodeCanvasFactory {
6888
7210
  create(width, height) {
6889
7211
  const factory = this;
@@ -6923,96 +7245,6 @@ var NodeCanvasFactory2 = class extends NodeCanvasFactory {
6923
7245
  };
6924
7246
  }
6925
7247
  };
6926
- var _NodeFilterFactory_instances, createTables_fn2;
6927
- var NodeFilterFactory2 = class extends NodeFilterFactory {
6928
- constructor() {
6929
- super(...arguments);
6930
- __privateAdd(this, _NodeFilterFactory_instances);
6931
- }
6932
- addAlphaFilter(map) {
6933
- const [tableA] = __privateMethod(this, _NodeFilterFactory_instances, createTables_fn2).call(this, [map]);
6934
- const url = `url(#alpha_${tableA.join("_")})`;
6935
- if (!filtersRegistry.has(url)) {
6936
- filtersRegistry.set(url, (ctx) => {
6937
- const imageData = ctx.getImageData(
6938
- 0,
6939
- 0,
6940
- ctx.canvas.width,
6941
- ctx.canvas.height
6942
- );
6943
- const data = imageData.data;
6944
- const tableSize = tableA.length;
6945
- for (let i = 0; i < data.length; i += 4) {
6946
- const alpha = data[i + 3] / 255;
6947
- const index = alpha * (tableSize - 1);
6948
- const lower = Math.floor(index);
6949
- const upper = Math.min(lower + 1, tableSize - 1);
6950
- const t = index - lower;
6951
- const newAlpha = (1 - t) * tableA[lower] + t * tableA[upper];
6952
- data[i + 3] = newAlpha * 255;
6953
- }
6954
- ctx.putImageData(imageData, 0, 0);
6955
- });
6956
- }
6957
- return url;
6958
- }
6959
- addLuminosityFilter(map) {
6960
- const url = `url(#luminosity${map ? `_${map.join("_")}` : ""})`;
6961
- if (!filtersRegistry.has(url)) {
6962
- const tables = map ? __privateMethod(this, _NodeFilterFactory_instances, createTables_fn2).call(this, [map]) : null;
6963
- const tableA = tables ? tables[0] : null;
6964
- const tableSize = tableA?.length;
6965
- filtersRegistry.set(url, (ctx) => {
6966
- const imageData = ctx.getImageData(
6967
- 0,
6968
- 0,
6969
- ctx.canvas.width,
6970
- ctx.canvas.height
6971
- );
6972
- const data = imageData.data;
6973
- for (let i = 0; i < data.length; i += 4) {
6974
- const r = data[i];
6975
- const g = data[i + 1];
6976
- const b = data[i + 2];
6977
- data[i] = data[i + 1] = data[i + 2] = 0;
6978
- data[i + 3] = r * 0.3 + g * 0.59 + b * 0.11;
6979
- if (tableA && tableSize != null) {
6980
- const alpha = data[i + 3] / 255;
6981
- const index = alpha * (tableSize - 1);
6982
- const lower = Math.floor(index);
6983
- const upper = Math.min(lower + 1, tableSize - 1);
6984
- const t = index - lower;
6985
- const newAlpha = (1 - t) * tableA[lower] + t * tableA[upper];
6986
- data[i + 3] = newAlpha * 255;
6987
- }
6988
- }
6989
- ctx.putImageData(imageData, 0, 0);
6990
- });
6991
- }
6992
- return url;
6993
- }
6994
- };
6995
- _NodeFilterFactory_instances = new WeakSet();
6996
- createTables_fn2 = function(maps) {
6997
- if (maps.length === 1) {
6998
- const mapR2 = maps[0];
6999
- const buffer = new Array(256);
7000
- for (let i = 0; i < 256; i++) {
7001
- buffer[i] = mapR2[i] / 255;
7002
- }
7003
- return [buffer, buffer, buffer];
7004
- }
7005
- const [mapR, mapG, mapB] = maps;
7006
- const bufferR = new Array(256);
7007
- const bufferG = new Array(256);
7008
- const bufferB = new Array(256);
7009
- for (let i = 0; i < 256; i++) {
7010
- bufferR[i] = mapR[i] / 255;
7011
- bufferG[i] = mapG[i] / 255;
7012
- bufferB[i] = mapB[i] / 255;
7013
- }
7014
- return [bufferR, bufferG, bufferB];
7015
- };
7016
7248
 
7017
7249
  // src/pdf.js/src/display/pattern_helper.js
7018
7250
  var PathType = {
@@ -25851,73 +26083,6 @@ async function toSvgNode(ctx) {
25851
26083
  return ctx.getNode();
25852
26084
  }
25853
26085
 
25854
- // src/lib/utils.ts
25855
- async function canvasToData(canvas) {
25856
- if ("toBlob" in canvas) {
25857
- const blob = await new Promise(
25858
- (resolve) => canvas.toBlob((data) => resolve(data))
25859
- );
25860
- if (!blob) {
25861
- throw new Error("Failed to generate graphics");
25862
- }
25863
- return new Uint8Array(await blob.arrayBuffer());
25864
- }
25865
- const buffer = await canvas.encode("png");
25866
- return new Uint8Array(buffer);
25867
- }
25868
- async function toDataUrl(data, type = "image/png") {
25869
- if (typeof FileReader !== "undefined") {
25870
- return new Promise((resolve) => {
25871
- const reader = new FileReader();
25872
- reader.onload = () => {
25873
- resolve(reader.result);
25874
- };
25875
- reader.readAsDataURL(new Blob([data], { type }));
25876
- });
25877
- }
25878
- return `data:${type};base64,${Buffer.from(data).toString("base64")}`;
25879
- }
25880
- function makeSerializable(object) {
25881
- if (typeof object !== "object" || object === null) {
25882
- return object;
25883
- }
25884
- if (object instanceof Int8Array || object instanceof Uint8Array || object instanceof Uint8ClampedArray || object instanceof Int16Array || object instanceof Uint16Array || object instanceof Int32Array || object instanceof Uint32Array || object instanceof Float32Array || object instanceof Float64Array) {
25885
- return makeSerializable(Array.from(object));
25886
- }
25887
- if (object instanceof BigInt64Array || object instanceof BigUint64Array) {
25888
- return makeSerializable(Array.from(object));
25889
- }
25890
- if (Array.isArray(object)) {
25891
- return object.map(makeSerializable);
25892
- }
25893
- return Object.fromEntries(
25894
- Object.entries(object).map(([key, value]) => [
25895
- key,
25896
- makeSerializable(value)
25897
- ])
25898
- );
25899
- }
25900
- function colorToRgb(color) {
25901
- if (color.startsWith("#")) {
25902
- const hex = color.slice(1);
25903
- if (hex.length === 3) {
25904
- return [
25905
- Number.parseInt(hex[0] + hex[0], 16),
25906
- Number.parseInt(hex[1] + hex[1], 16),
25907
- Number.parseInt(hex[2] + hex[2], 16)
25908
- ];
25909
- }
25910
- if (hex.length === 6) {
25911
- return [
25912
- Number.parseInt(hex.slice(0, 2), 16),
25913
- Number.parseInt(hex.slice(2, 4), 16),
25914
- Number.parseInt(hex.slice(4, 6), 16)
25915
- ];
25916
- }
25917
- }
25918
- throw new Error(`Invalid color format: ${color}`);
25919
- }
25920
-
25921
26086
  // src/lib/PDFPageProxy.ts
25922
26087
  var getAnnotations = PDFPageProxy.prototype.getAnnotations;
25923
26088
  PDFPageProxy.prototype.getAnnotations = async function(params) {
@@ -26818,6 +26983,7 @@ export {
26818
26983
  makeSerializable,
26819
26984
  noContextMenu,
26820
26985
  normalizeUnicode,
26986
+ rgbToHex,
26821
26987
  setLayerDimensions,
26822
26988
  shadow,
26823
26989
  stopEvent,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chialab/pdfjs-lib",
3
3
  "description": "A custom Mozilla's PDF.js build with better Node support and extras.",
4
- "version": "1.0.0-alpha.12",
4
+ "version": "1.0.0-alpha.14",
5
5
  "type": "module",
6
6
  "author": "Chialab <dev@chialab.it>",
7
7
  "license": "MIT",