pdfmake 0.1.56 → 0.1.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdfmake",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "description": "Client/server side PDF printing in pure JavaScript",
5
5
  "main": "src/printer.js",
6
6
  "browser": "build/pdfmake.js",
@@ -10,19 +10,19 @@
10
10
  "dependencies": {
11
11
  "iconv-lite": "^0.4.24",
12
12
  "linebreak": "^0.3.0",
13
- "pdfkit": "^0.9.1"
13
+ "pdfkit": "^0.10.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@babel/core": "^7.4.4",
16
+ "@babel/core": "^7.4.5",
17
17
  "@babel/plugin-transform-modules-commonjs": "^7.4.4",
18
- "@babel/preset-env": "^7.4.4",
19
- "babel-loader": "^8.0.5",
18
+ "@babel/preset-env": "^7.4.5",
19
+ "babel-loader": "^8.0.6",
20
20
  "brfs": "^2.0.2",
21
- "eslint-plugin-jsdoc": "^4.8.3",
21
+ "eslint-plugin-jsdoc": "^7.2.3",
22
22
  "expose-loader": "^0.7.5",
23
23
  "fancy-log": "^1.3.3",
24
- "file-saver": "^2.0.1",
25
- "gulp": "^4.0.1",
24
+ "file-saver": "^2.0.2",
25
+ "gulp": "^4.0.2",
26
26
  "gulp-each": "^0.5.0",
27
27
  "gulp-eslint": "^5.0.0",
28
28
  "gulp-file-contents-to-json": "^0.2.2",
@@ -32,8 +32,8 @@
32
32
  "sinon": "^7.3.2",
33
33
  "string-replace-webpack-plugin": "^0.1.3",
34
34
  "transform-loader": "^0.2.4",
35
- "uglifyjs-webpack-plugin": "^2.1.2",
36
- "webpack": "^4.30.0"
35
+ "uglifyjs-webpack-plugin": "^2.1.3",
36
+ "webpack": "^4.33.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "gulp build",
@@ -2,6 +2,7 @@
2
2
 
3
3
  var isFunction = require('../helpers').isFunction;
4
4
  var isUndefined = require('../helpers').isUndefined;
5
+ var isNull = require('../helpers').isNull;
5
6
  var FileSaver = require('file-saver');
6
7
  var saveAs = FileSaver.saveAs;
7
8
 
@@ -111,6 +112,16 @@ Document.prototype._openPdf = function (options, win) {
111
112
  var urlCreator = window.URL || window.webkitURL;
112
113
  var pdfUrl = urlCreator.createObjectURL(result);
113
114
  win.location.href = pdfUrl;
115
+
116
+ /* temporarily disabled
117
+ if (win !== window) {
118
+ setTimeout(function () {
119
+ if (isNull(win.window)) { // is closed by AdBlock
120
+ window.location.href = pdfUrl; // open in actual window
121
+ }
122
+ }, 500);
123
+ }
124
+ */
114
125
  }, options);
115
126
  } catch (e) {
116
127
  win.close();
@@ -159,6 +159,15 @@ DocumentContext.prototype.moveTo = function (x, y) {
159
159
  }
160
160
  };
161
161
 
162
+ DocumentContext.prototype.moveToRelative = function (x, y) {
163
+ if (x !== undefined && x !== null) {
164
+ this.x = this.x + x;
165
+ }
166
+ if (y !== undefined && y !== null) {
167
+ this.y = this.y + y;
168
+ }
169
+ };
170
+
162
171
  DocumentContext.prototype.beginDetachedBlock = function () {
163
172
  this.snapshots.push({
164
173
  x: this.x,
@@ -358,7 +358,7 @@ LayoutBuilder.prototype.processNode = function (node) {
358
358
  var relPosition = node.relativePosition;
359
359
  if (relPosition) {
360
360
  self.writer.context().beginDetachedBlock();
361
- self.writer.context().moveTo((relPosition.x || 0) + self.writer.context().x, (relPosition.y || 0) + self.writer.context().y);
361
+ self.writer.context().moveToRelative(relPosition.x || 0, relPosition.y || 0);
362
362
  }
363
363
 
364
364
  if (node.stack) {
package/src/printer.js CHANGED
@@ -391,10 +391,6 @@ function renderLine(line, x, y, pdfKitDoc) {
391
391
  var pageNumber = _pageNodeRef.positions[0].pageNumber.toString();
392
392
 
393
393
  inline.text = pageNumber;
394
- // TODO: Remove after release new pdfkit version with PR https://github.com/foliojs/pdfkit/pull/947
395
- if (typeof pdfKitDoc.addNamedDestination != 'function') {
396
- inline.linkToPage = pageNumber;
397
- }
398
394
  newWidth = textTools.widthOfString(inline.text, inline.font, inline.fontSize, inline.characterSpacing, inline.fontFeatures);
399
395
  diffWidth = inline.width - newWidth;
400
396
  inline.width = newWidth;