@chialab/pdfjs-lib 1.0.0-alpha.7 → 1.0.0-alpha.8
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 +15 -4
- package/dist/node/index.js +15 -4
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -24457,12 +24457,13 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24457
24457
|
} else {
|
|
24458
24458
|
let firstStroke = true;
|
|
24459
24459
|
let firstFill = true;
|
|
24460
|
+
let firstText = true;
|
|
24460
24461
|
let currentFillColor = null;
|
|
24461
24462
|
let currentLineWidth = null;
|
|
24462
24463
|
for (const { fn, args } of opList) {
|
|
24463
24464
|
const finalFn = fn === OPS.constructPath ? args[0] : fn;
|
|
24464
24465
|
if (finalFn === OPS.fill) {
|
|
24465
|
-
if (currentFillColor) {
|
|
24466
|
+
if (currentFillColor && firstFill) {
|
|
24466
24467
|
annotation.interiorColor = currentFillColor;
|
|
24467
24468
|
currentFillColor = null;
|
|
24468
24469
|
}
|
|
@@ -24474,7 +24475,7 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24474
24475
|
continue;
|
|
24475
24476
|
}
|
|
24476
24477
|
if (finalFn === OPS.stroke || finalFn === OPS.closeStroke) {
|
|
24477
|
-
if (currentLineWidth === null) {
|
|
24478
|
+
if (currentLineWidth === null && firstStroke) {
|
|
24478
24479
|
annotation.borderStyle.width = 1;
|
|
24479
24480
|
}
|
|
24480
24481
|
firstStroke = false;
|
|
@@ -24482,11 +24483,11 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24482
24483
|
continue;
|
|
24483
24484
|
}
|
|
24484
24485
|
if (finalFn === OPS.fillStroke || finalFn === OPS.closeFillStroke) {
|
|
24485
|
-
if (currentFillColor) {
|
|
24486
|
+
if (currentFillColor && firstFill) {
|
|
24486
24487
|
annotation.interiorColor = currentFillColor;
|
|
24487
24488
|
currentFillColor = null;
|
|
24488
24489
|
}
|
|
24489
|
-
if (currentLineWidth === null) {
|
|
24490
|
+
if (currentLineWidth === null && firstStroke) {
|
|
24490
24491
|
annotation.borderStyle.width = 1;
|
|
24491
24492
|
}
|
|
24492
24493
|
firstStroke = false;
|
|
@@ -24519,6 +24520,16 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24519
24520
|
}
|
|
24520
24521
|
}
|
|
24521
24522
|
}
|
|
24523
|
+
if (fn === OPS.setFont && firstText) {
|
|
24524
|
+
const fontName = args[0];
|
|
24525
|
+
const font = fontName.startsWith("g_") ? this.commonObjs.get(fontName) : this.objs.get(fontName);
|
|
24526
|
+
if (font) {
|
|
24527
|
+
annotation.defaultAppearanceData.fontName = font.fallbackName;
|
|
24528
|
+
}
|
|
24529
|
+
}
|
|
24530
|
+
if (fn === OPS.endText) {
|
|
24531
|
+
firstText = false;
|
|
24532
|
+
}
|
|
24522
24533
|
}
|
|
24523
24534
|
}
|
|
24524
24535
|
}
|
package/dist/node/index.js
CHANGED
|
@@ -24767,12 +24767,13 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24767
24767
|
} else {
|
|
24768
24768
|
let firstStroke = true;
|
|
24769
24769
|
let firstFill = true;
|
|
24770
|
+
let firstText = true;
|
|
24770
24771
|
let currentFillColor = null;
|
|
24771
24772
|
let currentLineWidth = null;
|
|
24772
24773
|
for (const { fn, args } of opList) {
|
|
24773
24774
|
const finalFn = fn === OPS.constructPath ? args[0] : fn;
|
|
24774
24775
|
if (finalFn === OPS.fill) {
|
|
24775
|
-
if (currentFillColor) {
|
|
24776
|
+
if (currentFillColor && firstFill) {
|
|
24776
24777
|
annotation.interiorColor = currentFillColor;
|
|
24777
24778
|
currentFillColor = null;
|
|
24778
24779
|
}
|
|
@@ -24784,7 +24785,7 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24784
24785
|
continue;
|
|
24785
24786
|
}
|
|
24786
24787
|
if (finalFn === OPS.stroke || finalFn === OPS.closeStroke) {
|
|
24787
|
-
if (currentLineWidth === null) {
|
|
24788
|
+
if (currentLineWidth === null && firstStroke) {
|
|
24788
24789
|
annotation.borderStyle.width = 1;
|
|
24789
24790
|
}
|
|
24790
24791
|
firstStroke = false;
|
|
@@ -24792,11 +24793,11 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24792
24793
|
continue;
|
|
24793
24794
|
}
|
|
24794
24795
|
if (finalFn === OPS.fillStroke || finalFn === OPS.closeFillStroke) {
|
|
24795
|
-
if (currentFillColor) {
|
|
24796
|
+
if (currentFillColor && firstFill) {
|
|
24796
24797
|
annotation.interiorColor = currentFillColor;
|
|
24797
24798
|
currentFillColor = null;
|
|
24798
24799
|
}
|
|
24799
|
-
if (currentLineWidth === null) {
|
|
24800
|
+
if (currentLineWidth === null && firstStroke) {
|
|
24800
24801
|
annotation.borderStyle.width = 1;
|
|
24801
24802
|
}
|
|
24802
24803
|
firstStroke = false;
|
|
@@ -24829,6 +24830,16 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24829
24830
|
}
|
|
24830
24831
|
}
|
|
24831
24832
|
}
|
|
24833
|
+
if (fn === OPS.setFont && firstText) {
|
|
24834
|
+
const fontName = args[0];
|
|
24835
|
+
const font = fontName.startsWith("g_") ? this.commonObjs.get(fontName) : this.objs.get(fontName);
|
|
24836
|
+
if (font) {
|
|
24837
|
+
annotation.defaultAppearanceData.fontName = font.fallbackName;
|
|
24838
|
+
}
|
|
24839
|
+
}
|
|
24840
|
+
if (fn === OPS.endText) {
|
|
24841
|
+
firstText = false;
|
|
24842
|
+
}
|
|
24832
24843
|
}
|
|
24833
24844
|
}
|
|
24834
24845
|
}
|
package/package.json
CHANGED