pdfmake 0.2.2 → 0.2.3
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/CHANGELOG.md +8 -2
- package/build/pdfmake.js +4036 -2687
- package/build/pdfmake.js.map +1 -1
- package/build/pdfmake.min.js +2 -2
- package/build/pdfmake.min.js.map +1 -1
- package/package.json +6 -4
- package/src/3rd-party/svg-to-pdfkit/LICENSE +9 -0
- package/src/3rd-party/svg-to-pdfkit/source.js +2552 -0
- package/src/3rd-party/svg-to-pdfkit.js +3 -0
- package/src/browser-extensions/pdfMake.js +8 -13
- package/src/helpers.js +14 -1
- package/src/printer.js +705 -685
- package/src/svgMeasure.js +1 -1
- package/src/tableProcessor.js +31 -12
- package/src/textDecorator.js +8 -2
package/src/svgMeasure.js
CHANGED
package/src/tableProcessor.js
CHANGED
|
@@ -426,8 +426,10 @@ TableProcessor.prototype.endRow = function (rowIndex, writer, pageBreaks) {
|
|
|
426
426
|
}
|
|
427
427
|
if (!isNumber(fillOpacity)) {
|
|
428
428
|
fillOpacity = isFunction(this.layout.fillOpacity) ? this.layout.fillOpacity(rowIndex, this.tableNode, colIndex) : this.layout.fillOpacity;
|
|
429
|
-
|
|
430
|
-
|
|
429
|
+
}
|
|
430
|
+
var overlayPattern = body[rowIndex][colIndex].overlayPattern;
|
|
431
|
+
var overlayOpacity = body[rowIndex][colIndex].overlayOpacity;
|
|
432
|
+
if (fillColor || overlayPattern) {
|
|
431
433
|
var widthLeftBorder = leftCellBorder ? this.layout.vLineWidth(colIndex, this.tableNode) : 0;
|
|
432
434
|
var widthRightBorder;
|
|
433
435
|
if ((colIndex === 0 || colIndex + 1 == body[rowIndex].length) && !rightCellBorder) {
|
|
@@ -442,16 +444,33 @@ TableProcessor.prototype.endRow = function (rowIndex, writer, pageBreaks) {
|
|
|
442
444
|
var y1f = this.dontBreakRows ? y1 : y1 - (hzLineOffset / 2);
|
|
443
445
|
var x2f = xs[i + 1].x + widthRightBorder;
|
|
444
446
|
var y2f = this.dontBreakRows ? y2 + this.bottomLineWidth : y2 + (this.bottomLineWidth / 2);
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
447
|
+
var bgWidth = x2f - x1f;
|
|
448
|
+
var bgHeight = y2f - y1f;
|
|
449
|
+
if (fillColor) {
|
|
450
|
+
writer.addVector({
|
|
451
|
+
type: 'rect',
|
|
452
|
+
x: x1f,
|
|
453
|
+
y: y1f,
|
|
454
|
+
w: bgWidth,
|
|
455
|
+
h: bgHeight,
|
|
456
|
+
lineWidth: 0,
|
|
457
|
+
color: fillColor,
|
|
458
|
+
fillOpacity: fillOpacity
|
|
459
|
+
}, false, true, writer.context().backgroundLength[writer.context().page]);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (overlayPattern) {
|
|
463
|
+
writer.addVector({
|
|
464
|
+
type: 'rect',
|
|
465
|
+
x: x1f,
|
|
466
|
+
y: y1f,
|
|
467
|
+
w: bgWidth,
|
|
468
|
+
h: bgHeight,
|
|
469
|
+
lineWidth: 0,
|
|
470
|
+
color: overlayPattern,
|
|
471
|
+
fillOpacity: overlayOpacity
|
|
472
|
+
}, false, true);
|
|
473
|
+
}
|
|
455
474
|
}
|
|
456
475
|
}
|
|
457
476
|
}
|
package/src/textDecorator.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var isArray = require('./helpers').isArray;
|
|
4
|
+
var isPattern = require('./helpers').isPattern;
|
|
5
|
+
var getPattern = require('./helpers').getPattern;
|
|
4
6
|
|
|
5
7
|
function groupDecorations(line) {
|
|
6
8
|
var groups = [], currentGroup = null;
|
|
@@ -131,15 +133,19 @@ function drawDecorations(line, x, y, pdfKitDoc) {
|
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
function drawBackground(line, x, y, pdfKitDoc) {
|
|
136
|
+
function drawBackground(line, x, y, patterns, pdfKitDoc) {
|
|
135
137
|
var height = line.getHeight();
|
|
136
138
|
for (var i = 0, l = line.inlines.length; i < l; i++) {
|
|
137
139
|
var inline = line.inlines[i];
|
|
138
140
|
if (!inline.background) {
|
|
139
141
|
continue;
|
|
140
142
|
}
|
|
143
|
+
var color = inline.background;
|
|
144
|
+
if (isPattern(inline.background)) {
|
|
145
|
+
color = getPattern(inline.background, patterns);
|
|
146
|
+
}
|
|
141
147
|
var justifyShift = (inline.justifyShift || 0);
|
|
142
|
-
pdfKitDoc.fillColor(
|
|
148
|
+
pdfKitDoc.fillColor(color)
|
|
143
149
|
.rect(x + inline.x - justifyShift, y, inline.width + justifyShift, height)
|
|
144
150
|
.fill();
|
|
145
151
|
}
|