@chialab/pdfjs-lib 1.0.0-alpha.45 → 1.0.0-alpha.47
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.
- package/dist/browser/index.js +33 -34
- package/dist/browser/worker.js +56 -4
- package/dist/lib/ColorSpace.d.ts +6 -0
- package/dist/lib/SvgCanvasContext.d.ts +3 -0
- package/dist/node/index.js +33 -34
- package/dist/node/worker.js +56 -4
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -27977,6 +27977,7 @@ var SvgCanvasContext = class {
|
|
|
27977
27977
|
__publicField(this, "_ctx", null);
|
|
27978
27978
|
__publicField(this, "_currentStyle", {
|
|
27979
27979
|
strokeStyle: "#000000",
|
|
27980
|
+
colorSpace: null,
|
|
27980
27981
|
fillStyle: "#000000",
|
|
27981
27982
|
fillRule: "nonzero",
|
|
27982
27983
|
filter: "none",
|
|
@@ -28645,6 +28646,9 @@ var SvgCanvasContext = class {
|
|
|
28645
28646
|
}
|
|
28646
28647
|
this._currentMarked = this._markedStack.pop() ?? null;
|
|
28647
28648
|
}
|
|
28649
|
+
setColorSpace(colorSpaceInfo) {
|
|
28650
|
+
this._currentStyle.colorSpace = colorSpaceInfo ?? null;
|
|
28651
|
+
}
|
|
28648
28652
|
_ensureTransformationGroup() {
|
|
28649
28653
|
const group = {
|
|
28650
28654
|
tag: "g",
|
|
@@ -28870,6 +28874,11 @@ var SvgCanvasContext = class {
|
|
|
28870
28874
|
currentElement.attrs["stroke-dasharray"] = `${this._currentStyle.lineDash.map((entry) => `${entry * Math.max(scale.x, scale.y)}`).join(",")}`;
|
|
28871
28875
|
}
|
|
28872
28876
|
}
|
|
28877
|
+
const colorSpace = this._currentStyle.colorSpace;
|
|
28878
|
+
if (colorSpace) {
|
|
28879
|
+
currentElement.attrs["color-space-name"] = colorSpace.name;
|
|
28880
|
+
currentElement.attrs["color-space-type"] = colorSpace.type;
|
|
28881
|
+
}
|
|
28873
28882
|
}
|
|
28874
28883
|
_addPathCommand(command) {
|
|
28875
28884
|
if (!this._currentElement || !isSvgPath(this._currentElement)) {
|
|
@@ -29849,42 +29858,16 @@ async function createTextLayer(page, {
|
|
|
29849
29858
|
}
|
|
29850
29859
|
if (oldTextItem?.glyphs.length) {
|
|
29851
29860
|
if (newTextItem) {
|
|
29852
|
-
const text = oldTextItem.glyphs.map((g) => g[0].unicode).join("") || "";
|
|
29853
|
-
const dir = bidi(text).dir;
|
|
29854
|
-
const firstGlyph = oldTextItem.glyphs[0];
|
|
29855
|
-
const lastGlyph = oldTextItem.glyphs.at(-1);
|
|
29856
|
-
const scale = oldTextItem.scaleX * oldTextItem.fontSize;
|
|
29857
29861
|
const top = oldTextItem.top;
|
|
29858
29862
|
const bottom = oldTextItem.top + oldTextItem.fontSize;
|
|
29859
|
-
const left = oldTextItem.left;
|
|
29860
|
-
const right = oldTextItem.left + (lastGlyph[1] + lastGlyph[2]) * scale;
|
|
29861
29863
|
const nextTop = newTextItem.top;
|
|
29862
29864
|
const nextBottom = newTextItem.top + newTextItem.fontSize;
|
|
29863
|
-
|
|
29864
|
-
|
|
29865
|
-
|
|
29866
|
-
|
|
29867
|
-
|
|
29868
|
-
|
|
29869
|
-
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
29870
|
-
appendNewLineAsNeeded();
|
|
29871
|
-
return;
|
|
29872
|
-
}
|
|
29873
|
-
}
|
|
29874
|
-
break;
|
|
29875
|
-
}
|
|
29876
|
-
case "rtl": {
|
|
29877
|
-
if (left - newTextItem.left < firstGlyph[2] * scale) {
|
|
29878
|
-
if (nextTop > top && nextTop < bottom || nextBottom > top && nextBottom < bottom) {
|
|
29879
|
-
return;
|
|
29880
|
-
}
|
|
29881
|
-
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
29882
|
-
appendNewLineAsNeeded();
|
|
29883
|
-
return;
|
|
29884
|
-
}
|
|
29885
|
-
}
|
|
29886
|
-
break;
|
|
29887
|
-
}
|
|
29865
|
+
if (nextTop > top && nextTop < bottom || nextBottom > top && nextBottom < bottom || nextTop <= top && nextBottom >= bottom) {
|
|
29866
|
+
return;
|
|
29867
|
+
}
|
|
29868
|
+
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
29869
|
+
appendNewLineAsNeeded();
|
|
29870
|
+
return;
|
|
29888
29871
|
}
|
|
29889
29872
|
}
|
|
29890
29873
|
closeMarkedContent();
|
|
@@ -30224,7 +30207,9 @@ var {
|
|
|
30224
30207
|
endText,
|
|
30225
30208
|
beginMarkedContent,
|
|
30226
30209
|
beginMarkedContentProps,
|
|
30227
|
-
endMarkedContent
|
|
30210
|
+
endMarkedContent,
|
|
30211
|
+
setFillRGBColor,
|
|
30212
|
+
setStrokeRGBColor
|
|
30228
30213
|
} = CanvasGraphics.prototype;
|
|
30229
30214
|
CanvasGraphics.prototype.beginDrawing = function(options) {
|
|
30230
30215
|
if (this.ctx instanceof SvgCanvasContext) {
|
|
@@ -30262,12 +30247,26 @@ CanvasGraphics.prototype.endMarkedContent = function(opIdx) {
|
|
|
30262
30247
|
}
|
|
30263
30248
|
endMarkedContent.call(this, opIdx);
|
|
30264
30249
|
};
|
|
30250
|
+
CanvasGraphics.prototype.setFillRGBColor = function(opIdx, color, colorSpaceInfo) {
|
|
30251
|
+
if (this.ctx instanceof SvgCanvasContext) {
|
|
30252
|
+
this.ctx.setColorSpace(colorSpaceInfo);
|
|
30253
|
+
}
|
|
30254
|
+
setFillRGBColor.call(this, opIdx, color);
|
|
30255
|
+
};
|
|
30256
|
+
CanvasGraphics.prototype.setStrokeRGBColor = function(opIdx, color, colorSpaceInfo) {
|
|
30257
|
+
if (this.ctx instanceof SvgCanvasContext) {
|
|
30258
|
+
this.ctx.setColorSpace(colorSpaceInfo);
|
|
30259
|
+
}
|
|
30260
|
+
setStrokeRGBColor.call(this, opIdx, color);
|
|
30261
|
+
};
|
|
30265
30262
|
Object.assign(CanvasGraphics.prototype, {
|
|
30266
30263
|
[OPS.beginText]: CanvasGraphics.prototype.beginText,
|
|
30267
30264
|
[OPS.endText]: CanvasGraphics.prototype.endText,
|
|
30268
30265
|
[OPS.beginMarkedContent]: CanvasGraphics.prototype.beginMarkedContent,
|
|
30269
30266
|
[OPS.beginMarkedContentProps]: CanvasGraphics.prototype.beginMarkedContentProps,
|
|
30270
|
-
[OPS.endMarkedContent]: CanvasGraphics.prototype.endMarkedContent
|
|
30267
|
+
[OPS.endMarkedContent]: CanvasGraphics.prototype.endMarkedContent,
|
|
30268
|
+
[OPS.setFillRGBColor]: CanvasGraphics.prototype.setFillRGBColor,
|
|
30269
|
+
[OPS.setStrokeRGBColor]: CanvasGraphics.prototype.setStrokeRGBColor
|
|
30271
30270
|
});
|
|
30272
30271
|
|
|
30273
30272
|
// src/index.ts
|
package/dist/browser/worker.js
CHANGED
|
@@ -24067,7 +24067,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|
|
24067
24067
|
let x = 0, y = 0;
|
|
24068
24068
|
let stems = 0;
|
|
24069
24069
|
let firstPoint = null;
|
|
24070
|
-
function
|
|
24070
|
+
function parse2(code) {
|
|
24071
24071
|
let i = 0;
|
|
24072
24072
|
while (i < code.length) {
|
|
24073
24073
|
let stackClean = false;
|
|
@@ -24149,7 +24149,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|
|
24149
24149
|
subrCode = font.subrs[n + font.subrsBias];
|
|
24150
24150
|
}
|
|
24151
24151
|
if (subrCode) {
|
|
24152
|
-
|
|
24152
|
+
parse2(subrCode);
|
|
24153
24153
|
}
|
|
24154
24154
|
break;
|
|
24155
24155
|
case 11:
|
|
@@ -24348,7 +24348,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|
|
24348
24348
|
n = stack.pop() + font.gsubrsBias;
|
|
24349
24349
|
subrCode = font.gsubrs[n];
|
|
24350
24350
|
if (subrCode) {
|
|
24351
|
-
|
|
24351
|
+
parse2(subrCode);
|
|
24352
24352
|
}
|
|
24353
24353
|
break;
|
|
24354
24354
|
case 30:
|
|
@@ -24416,7 +24416,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|
|
24416
24416
|
}
|
|
24417
24417
|
}
|
|
24418
24418
|
}
|
|
24419
|
-
|
|
24419
|
+
parse2(charStringCode);
|
|
24420
24420
|
}
|
|
24421
24421
|
var NOOP = "";
|
|
24422
24422
|
var Commands = class {
|
|
@@ -77537,6 +77537,41 @@ AnnotationFactory.saveNewAnnotations = async (evaluator, task, annotations, imag
|
|
|
77537
77537
|
return data;
|
|
77538
77538
|
};
|
|
77539
77539
|
|
|
77540
|
+
// src/lib/ColorSpace.ts
|
|
77541
|
+
var colorSpacesInfo = /* @__PURE__ */ new Map();
|
|
77542
|
+
var parse = ColorSpaceUtils.parse;
|
|
77543
|
+
ColorSpaceUtils.parse = function(args) {
|
|
77544
|
+
const { cs, resources } = args;
|
|
77545
|
+
const result = parse.call(this, args);
|
|
77546
|
+
if (!resources) {
|
|
77547
|
+
return result;
|
|
77548
|
+
}
|
|
77549
|
+
const colorSpaces = resources.get("ColorSpace");
|
|
77550
|
+
if (!(colorSpaces instanceof Dict) || !(cs instanceof Name)) {
|
|
77551
|
+
return result;
|
|
77552
|
+
}
|
|
77553
|
+
const entry = colorSpaces.get(cs.name);
|
|
77554
|
+
if (!entry) {
|
|
77555
|
+
return result;
|
|
77556
|
+
}
|
|
77557
|
+
const type = entry[0] instanceof Name ? entry[0].name : null;
|
|
77558
|
+
const name = entry[1] instanceof Name ? entry[1].name : null;
|
|
77559
|
+
if (!type || !name) {
|
|
77560
|
+
return result;
|
|
77561
|
+
}
|
|
77562
|
+
if (result instanceof ColorSpace) {
|
|
77563
|
+
colorSpacesInfo.set(result, { type, name });
|
|
77564
|
+
return result;
|
|
77565
|
+
}
|
|
77566
|
+
return result.then((result2) => {
|
|
77567
|
+
colorSpacesInfo.set(result2, { type, name });
|
|
77568
|
+
return result2;
|
|
77569
|
+
});
|
|
77570
|
+
};
|
|
77571
|
+
var getColorSpaceInfo = (cs) => {
|
|
77572
|
+
return colorSpacesInfo.get(cs) || null;
|
|
77573
|
+
};
|
|
77574
|
+
|
|
77540
77575
|
// src/lib/Evaluator.ts
|
|
77541
77576
|
var collectMarkedContentLanguage = (stream, xref) => {
|
|
77542
77577
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -77577,8 +77612,22 @@ var collectMarkedContentLanguage = (stream, xref) => {
|
|
|
77577
77612
|
stream.pos = pos;
|
|
77578
77613
|
return map;
|
|
77579
77614
|
};
|
|
77615
|
+
var getColorSpace = PartialEvaluator.prototype._getColorSpace;
|
|
77616
|
+
PartialEvaluator.prototype._getColorSpace = function(...args) {
|
|
77617
|
+
const self2 = this;
|
|
77618
|
+
const result = getColorSpace.apply(this, args);
|
|
77619
|
+
if (result instanceof ColorSpace) {
|
|
77620
|
+
self2._currentColorSpace = result;
|
|
77621
|
+
return result;
|
|
77622
|
+
}
|
|
77623
|
+
return result.then((cs) => {
|
|
77624
|
+
self2._currentColorSpace = cs;
|
|
77625
|
+
return cs;
|
|
77626
|
+
});
|
|
77627
|
+
};
|
|
77580
77628
|
var getOperatorList = PartialEvaluator.prototype.getOperatorList;
|
|
77581
77629
|
PartialEvaluator.prototype.getOperatorList = async function(options, ...args) {
|
|
77630
|
+
const self2 = this;
|
|
77582
77631
|
const { stream, operatorList } = options;
|
|
77583
77632
|
const languages = collectMarkedContentLanguage(stream, this.xref);
|
|
77584
77633
|
const addOp = operatorList.addOp;
|
|
@@ -77594,6 +77643,9 @@ PartialEvaluator.prototype.getOperatorList = async function(options, ...args) {
|
|
|
77594
77643
|
}
|
|
77595
77644
|
}
|
|
77596
77645
|
}
|
|
77646
|
+
if ((fn === OPS.setFillRGBColor || fn === OPS.setStrokeRGBColor) && self2._currentColorSpace) {
|
|
77647
|
+
args2.push(getColorSpaceInfo(self2._currentColorSpace));
|
|
77648
|
+
}
|
|
77597
77649
|
return addOp.call(this, fn, args2);
|
|
77598
77650
|
};
|
|
77599
77651
|
await getOperatorList.call(this, options, ...args);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ColorSpaceInfo } from './ColorSpace';
|
|
1
2
|
import { Path2D } from './Path2D';
|
|
2
3
|
import { type SvgElement, type SvgNode, type SvgRoot } from './Svg';
|
|
3
4
|
interface CanvasStyle {
|
|
4
5
|
strokeStyle: string | SvgLinearGradient | SvgPattern;
|
|
6
|
+
colorSpace: ColorSpaceInfo | null;
|
|
5
7
|
fillStyle: string | SvgLinearGradient | SvgRadialGradient | SvgPattern;
|
|
6
8
|
fillRule: CanvasFillRule;
|
|
7
9
|
filter: string;
|
|
@@ -141,6 +143,7 @@ export declare class SvgCanvasContext {
|
|
|
141
143
|
id: number;
|
|
142
144
|
} | null): void;
|
|
143
145
|
endMarkedContent(): void;
|
|
146
|
+
setColorSpace(colorSpaceInfo?: ColorSpaceInfo | null): void;
|
|
144
147
|
protected _ensureTransformationGroup(): SvgElement;
|
|
145
148
|
protected _addNode(node: SvgNode, parent?: SvgElement): void;
|
|
146
149
|
protected _applyStyleState(styleState: CanvasStyle): void;
|
package/dist/node/index.js
CHANGED
|
@@ -26578,6 +26578,7 @@ var SvgCanvasContext = class {
|
|
|
26578
26578
|
__publicField(this, "_ctx", null);
|
|
26579
26579
|
__publicField(this, "_currentStyle", {
|
|
26580
26580
|
strokeStyle: "#000000",
|
|
26581
|
+
colorSpace: null,
|
|
26581
26582
|
fillStyle: "#000000",
|
|
26582
26583
|
fillRule: "nonzero",
|
|
26583
26584
|
filter: "none",
|
|
@@ -27246,6 +27247,9 @@ var SvgCanvasContext = class {
|
|
|
27246
27247
|
}
|
|
27247
27248
|
this._currentMarked = this._markedStack.pop() ?? null;
|
|
27248
27249
|
}
|
|
27250
|
+
setColorSpace(colorSpaceInfo) {
|
|
27251
|
+
this._currentStyle.colorSpace = colorSpaceInfo ?? null;
|
|
27252
|
+
}
|
|
27249
27253
|
_ensureTransformationGroup() {
|
|
27250
27254
|
const group = {
|
|
27251
27255
|
tag: "g",
|
|
@@ -27471,6 +27475,11 @@ var SvgCanvasContext = class {
|
|
|
27471
27475
|
currentElement.attrs["stroke-dasharray"] = `${this._currentStyle.lineDash.map((entry) => `${entry * Math.max(scale.x, scale.y)}`).join(",")}`;
|
|
27472
27476
|
}
|
|
27473
27477
|
}
|
|
27478
|
+
const colorSpace = this._currentStyle.colorSpace;
|
|
27479
|
+
if (colorSpace) {
|
|
27480
|
+
currentElement.attrs["color-space-name"] = colorSpace.name;
|
|
27481
|
+
currentElement.attrs["color-space-type"] = colorSpace.type;
|
|
27482
|
+
}
|
|
27474
27483
|
}
|
|
27475
27484
|
_addPathCommand(command) {
|
|
27476
27485
|
if (!this._currentElement || !isSvgPath(this._currentElement)) {
|
|
@@ -28450,42 +28459,16 @@ async function createTextLayer(page, {
|
|
|
28450
28459
|
}
|
|
28451
28460
|
if (oldTextItem?.glyphs.length) {
|
|
28452
28461
|
if (newTextItem) {
|
|
28453
|
-
const text = oldTextItem.glyphs.map((g) => g[0].unicode).join("") || "";
|
|
28454
|
-
const dir = bidi(text).dir;
|
|
28455
|
-
const firstGlyph = oldTextItem.glyphs[0];
|
|
28456
|
-
const lastGlyph = oldTextItem.glyphs.at(-1);
|
|
28457
|
-
const scale = oldTextItem.scaleX * oldTextItem.fontSize;
|
|
28458
28462
|
const top = oldTextItem.top;
|
|
28459
28463
|
const bottom = oldTextItem.top + oldTextItem.fontSize;
|
|
28460
|
-
const left = oldTextItem.left;
|
|
28461
|
-
const right = oldTextItem.left + (lastGlyph[1] + lastGlyph[2]) * scale;
|
|
28462
28464
|
const nextTop = newTextItem.top;
|
|
28463
28465
|
const nextBottom = newTextItem.top + newTextItem.fontSize;
|
|
28464
|
-
|
|
28465
|
-
|
|
28466
|
-
|
|
28467
|
-
|
|
28468
|
-
|
|
28469
|
-
|
|
28470
|
-
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
28471
|
-
appendNewLineAsNeeded();
|
|
28472
|
-
return;
|
|
28473
|
-
}
|
|
28474
|
-
}
|
|
28475
|
-
break;
|
|
28476
|
-
}
|
|
28477
|
-
case "rtl": {
|
|
28478
|
-
if (left - newTextItem.left < firstGlyph[2] * scale) {
|
|
28479
|
-
if (nextTop > top && nextTop < bottom || nextBottom > top && nextBottom < bottom) {
|
|
28480
|
-
return;
|
|
28481
|
-
}
|
|
28482
|
-
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
28483
|
-
appendNewLineAsNeeded();
|
|
28484
|
-
return;
|
|
28485
|
-
}
|
|
28486
|
-
}
|
|
28487
|
-
break;
|
|
28488
|
-
}
|
|
28466
|
+
if (nextTop > top && nextTop < bottom || nextBottom > top && nextBottom < bottom || nextTop <= top && nextBottom >= bottom) {
|
|
28467
|
+
return;
|
|
28468
|
+
}
|
|
28469
|
+
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
28470
|
+
appendNewLineAsNeeded();
|
|
28471
|
+
return;
|
|
28489
28472
|
}
|
|
28490
28473
|
}
|
|
28491
28474
|
closeMarkedContent();
|
|
@@ -28825,7 +28808,9 @@ var {
|
|
|
28825
28808
|
endText,
|
|
28826
28809
|
beginMarkedContent,
|
|
28827
28810
|
beginMarkedContentProps,
|
|
28828
|
-
endMarkedContent
|
|
28811
|
+
endMarkedContent,
|
|
28812
|
+
setFillRGBColor,
|
|
28813
|
+
setStrokeRGBColor
|
|
28829
28814
|
} = CanvasGraphics.prototype;
|
|
28830
28815
|
CanvasGraphics.prototype.beginDrawing = function(options) {
|
|
28831
28816
|
if (this.ctx instanceof SvgCanvasContext) {
|
|
@@ -28863,12 +28848,26 @@ CanvasGraphics.prototype.endMarkedContent = function(opIdx) {
|
|
|
28863
28848
|
}
|
|
28864
28849
|
endMarkedContent.call(this, opIdx);
|
|
28865
28850
|
};
|
|
28851
|
+
CanvasGraphics.prototype.setFillRGBColor = function(opIdx, color, colorSpaceInfo) {
|
|
28852
|
+
if (this.ctx instanceof SvgCanvasContext) {
|
|
28853
|
+
this.ctx.setColorSpace(colorSpaceInfo);
|
|
28854
|
+
}
|
|
28855
|
+
setFillRGBColor.call(this, opIdx, color);
|
|
28856
|
+
};
|
|
28857
|
+
CanvasGraphics.prototype.setStrokeRGBColor = function(opIdx, color, colorSpaceInfo) {
|
|
28858
|
+
if (this.ctx instanceof SvgCanvasContext) {
|
|
28859
|
+
this.ctx.setColorSpace(colorSpaceInfo);
|
|
28860
|
+
}
|
|
28861
|
+
setStrokeRGBColor.call(this, opIdx, color);
|
|
28862
|
+
};
|
|
28866
28863
|
Object.assign(CanvasGraphics.prototype, {
|
|
28867
28864
|
[OPS.beginText]: CanvasGraphics.prototype.beginText,
|
|
28868
28865
|
[OPS.endText]: CanvasGraphics.prototype.endText,
|
|
28869
28866
|
[OPS.beginMarkedContent]: CanvasGraphics.prototype.beginMarkedContent,
|
|
28870
28867
|
[OPS.beginMarkedContentProps]: CanvasGraphics.prototype.beginMarkedContentProps,
|
|
28871
|
-
[OPS.endMarkedContent]: CanvasGraphics.prototype.endMarkedContent
|
|
28868
|
+
[OPS.endMarkedContent]: CanvasGraphics.prototype.endMarkedContent,
|
|
28869
|
+
[OPS.setFillRGBColor]: CanvasGraphics.prototype.setFillRGBColor,
|
|
28870
|
+
[OPS.setStrokeRGBColor]: CanvasGraphics.prototype.setStrokeRGBColor
|
|
28872
28871
|
});
|
|
28873
28872
|
|
|
28874
28873
|
// src/index.ts
|
package/dist/node/worker.js
CHANGED
|
@@ -24069,7 +24069,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|
|
24069
24069
|
let x = 0, y = 0;
|
|
24070
24070
|
let stems = 0;
|
|
24071
24071
|
let firstPoint = null;
|
|
24072
|
-
function
|
|
24072
|
+
function parse2(code) {
|
|
24073
24073
|
let i = 0;
|
|
24074
24074
|
while (i < code.length) {
|
|
24075
24075
|
let stackClean = false;
|
|
@@ -24151,7 +24151,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|
|
24151
24151
|
subrCode = font.subrs[n + font.subrsBias];
|
|
24152
24152
|
}
|
|
24153
24153
|
if (subrCode) {
|
|
24154
|
-
|
|
24154
|
+
parse2(subrCode);
|
|
24155
24155
|
}
|
|
24156
24156
|
break;
|
|
24157
24157
|
case 11:
|
|
@@ -24350,7 +24350,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|
|
24350
24350
|
n = stack.pop() + font.gsubrsBias;
|
|
24351
24351
|
subrCode = font.gsubrs[n];
|
|
24352
24352
|
if (subrCode) {
|
|
24353
|
-
|
|
24353
|
+
parse2(subrCode);
|
|
24354
24354
|
}
|
|
24355
24355
|
break;
|
|
24356
24356
|
case 30:
|
|
@@ -24418,7 +24418,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|
|
24418
24418
|
}
|
|
24419
24419
|
}
|
|
24420
24420
|
}
|
|
24421
|
-
|
|
24421
|
+
parse2(charStringCode);
|
|
24422
24422
|
}
|
|
24423
24423
|
var NOOP = "";
|
|
24424
24424
|
var Commands = class {
|
|
@@ -77539,6 +77539,41 @@ AnnotationFactory.saveNewAnnotations = async (evaluator, task, annotations, imag
|
|
|
77539
77539
|
return data;
|
|
77540
77540
|
};
|
|
77541
77541
|
|
|
77542
|
+
// src/lib/ColorSpace.ts
|
|
77543
|
+
var colorSpacesInfo = /* @__PURE__ */ new Map();
|
|
77544
|
+
var parse = ColorSpaceUtils.parse;
|
|
77545
|
+
ColorSpaceUtils.parse = function(args) {
|
|
77546
|
+
const { cs, resources } = args;
|
|
77547
|
+
const result = parse.call(this, args);
|
|
77548
|
+
if (!resources) {
|
|
77549
|
+
return result;
|
|
77550
|
+
}
|
|
77551
|
+
const colorSpaces = resources.get("ColorSpace");
|
|
77552
|
+
if (!(colorSpaces instanceof Dict) || !(cs instanceof Name)) {
|
|
77553
|
+
return result;
|
|
77554
|
+
}
|
|
77555
|
+
const entry = colorSpaces.get(cs.name);
|
|
77556
|
+
if (!entry) {
|
|
77557
|
+
return result;
|
|
77558
|
+
}
|
|
77559
|
+
const type = entry[0] instanceof Name ? entry[0].name : null;
|
|
77560
|
+
const name = entry[1] instanceof Name ? entry[1].name : null;
|
|
77561
|
+
if (!type || !name) {
|
|
77562
|
+
return result;
|
|
77563
|
+
}
|
|
77564
|
+
if (result instanceof ColorSpace) {
|
|
77565
|
+
colorSpacesInfo.set(result, { type, name });
|
|
77566
|
+
return result;
|
|
77567
|
+
}
|
|
77568
|
+
return result.then((result2) => {
|
|
77569
|
+
colorSpacesInfo.set(result2, { type, name });
|
|
77570
|
+
return result2;
|
|
77571
|
+
});
|
|
77572
|
+
};
|
|
77573
|
+
var getColorSpaceInfo = (cs) => {
|
|
77574
|
+
return colorSpacesInfo.get(cs) || null;
|
|
77575
|
+
};
|
|
77576
|
+
|
|
77542
77577
|
// src/lib/Evaluator.ts
|
|
77543
77578
|
var collectMarkedContentLanguage = (stream, xref) => {
|
|
77544
77579
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -77579,8 +77614,22 @@ var collectMarkedContentLanguage = (stream, xref) => {
|
|
|
77579
77614
|
stream.pos = pos;
|
|
77580
77615
|
return map;
|
|
77581
77616
|
};
|
|
77617
|
+
var getColorSpace = PartialEvaluator.prototype._getColorSpace;
|
|
77618
|
+
PartialEvaluator.prototype._getColorSpace = function(...args) {
|
|
77619
|
+
const self2 = this;
|
|
77620
|
+
const result = getColorSpace.apply(this, args);
|
|
77621
|
+
if (result instanceof ColorSpace) {
|
|
77622
|
+
self2._currentColorSpace = result;
|
|
77623
|
+
return result;
|
|
77624
|
+
}
|
|
77625
|
+
return result.then((cs) => {
|
|
77626
|
+
self2._currentColorSpace = cs;
|
|
77627
|
+
return cs;
|
|
77628
|
+
});
|
|
77629
|
+
};
|
|
77582
77630
|
var getOperatorList = PartialEvaluator.prototype.getOperatorList;
|
|
77583
77631
|
PartialEvaluator.prototype.getOperatorList = async function(options, ...args) {
|
|
77632
|
+
const self2 = this;
|
|
77584
77633
|
const { stream, operatorList } = options;
|
|
77585
77634
|
const languages = collectMarkedContentLanguage(stream, this.xref);
|
|
77586
77635
|
const addOp = operatorList.addOp;
|
|
@@ -77596,6 +77645,9 @@ PartialEvaluator.prototype.getOperatorList = async function(options, ...args) {
|
|
|
77596
77645
|
}
|
|
77597
77646
|
}
|
|
77598
77647
|
}
|
|
77648
|
+
if ((fn === OPS.setFillRGBColor || fn === OPS.setStrokeRGBColor) && self2._currentColorSpace) {
|
|
77649
|
+
args2.push(getColorSpaceInfo(self2._currentColorSpace));
|
|
77650
|
+
}
|
|
77599
77651
|
return addOp.call(this, fn, args2);
|
|
77600
77652
|
};
|
|
77601
77653
|
await getOperatorList.call(this, options, ...args);
|
package/package.json
CHANGED