1
1
/** @license
2
2
*
3
3
* jsPDF - PDF Document creation from JavaScript
4
- * Version 2.0 .0 Built on 2020-08-11T07:57:54.902Z
4
+ * Version 2.1 .0 Built on 2020-08-25T16:02:38.141Z
5
5
* CommitID 00000000
6
6
*
7
7
* Copyright (c) 2010-2020 James Hall <
[email protected] >, https://github.com/MrRio/jsPDF
@@ -3389,16 +3389,16 @@ function jsPDF(options) {
3389
3389
3390
3390
out("xref");
3391
3391
out("0 " + (objectNumber + 1));
3392
- out("0000000000 65535 f");
3392
+ out("0000000000 65535 f ");
3393
3393
for (var i = 1; i <= objectNumber; i++) {
3394
3394
var offset = offsets[i];
3395
3395
if (typeof offset === "function") {
3396
- out((p + offsets[i]()).slice(-10) + " 00000 n");
3396
+ out((p + offsets[i]()).slice(-10) + " 00000 n ");
3397
3397
} else {
3398
3398
if (typeof offsets[i] !== "undefined") {
3399
- out((p + offsets[i]).slice(-10) + " 00000 n");
3399
+ out((p + offsets[i]).slice(-10) + " 00000 n ");
3400
3400
} else {
3401
- out("0000000000 00000 n");
3401
+ out("0000000000 00000 n ");
3402
3402
}
3403
3403
}
3404
3404
}
@@ -3543,7 +3543,7 @@ function jsPDF(options) {
3543
3543
"<style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style>" +
3544
3544
'<body><iframe id="pdfViewer" src="' +
3545
3545
pdfJsUrl +
3546
- '?file=" width="500px" height="400px" />' +
3546
+ '?file=&downloadName=' + options.filename + ' " width="500px" height="400px" />' +
3547
3547
"</body></html>";
3548
3548
var PDFjsNewWindow = globalObject.open();
3549
3549
@@ -3553,6 +3553,7 @@ function jsPDF(options) {
3553
3553
PDFjsNewWindow.document.documentElement.querySelector(
3554
3554
"#pdfViewer"
3555
3555
).onload = function() {
3556
+ PDFjsNewWindow.document.title = options.filename;
3556
3557
PDFjsNewWindow.document.documentElement
3557
3558
.querySelector("#pdfViewer")
3558
3559
.contentWindow.PDFViewerApplication.open(
@@ -6384,7 +6385,7 @@ jsPDF.API = {
6384
6385
* @type {string}
6385
6386
* @memberof jsPDF#
6386
6387
*/
6387
- jsPDF.version = "2.0 .0";
6388
+ jsPDF.version = "2.1 .0";
6388
6389
6389
6390
/* global jsPDF */
6390
6391
@@ -11500,9 +11501,13 @@ var AcroForm = jsPDF.AcroForm;
11500
11501
var tempWidth = 0;
11501
11502
11502
11503
if (!Array.isArray(text) && typeof text !== "string") {
11503
- throw new Error(
11504
- "getTextDimensions expects text-parameter to be of type String or an Array of Strings."
11505
- );
11504
+ if (typeof text === "number") {
11505
+ text = String(text);
11506
+ } else {
11507
+ throw new Error(
11508
+ "getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings."
11509
+ );
11510
+ }
11506
11511
}
11507
11512
11508
11513
const maxWidth = options.maxWidth;
@@ -18141,18 +18146,6 @@ function Deflater(options) {
18141
18146
}
18142
18147
})(jsPDF.API);
18143
18148
18144
- /* eslint-disable no-unreachable */
18145
-
18146
- function loadOptionalLibrary(name, globalName) {
18147
- globalName = globalName || name;
18148
- if (globalObject[globalName]) {
18149
- return Promise.resolve(globalObject[globalName]);
18150
- }
18151
-
18152
- return import(name);
18153
-
18154
- }
18155
-
18156
18149
/**
18157
18150
* @license
18158
18151
* Copyright (c) 2018 Erik Koopmans
@@ -18171,15 +18164,37 @@ function loadOptionalLibrary(name, globalName) {
18171
18164
(function(jsPDFAPI) {
18172
18165
18173
18166
function loadHtml2Canvas() {
18174
- return loadOptionalLibrary("html2canvas").catch(function(e) {
18175
- return Promise.reject(new Error("Could not load html2canvas: " + e));
18176
- });
18167
+ return (function() {
18168
+ if (globalObject["html2canvas"]) {
18169
+ return Promise.resolve(globalObject["html2canvas"]);
18170
+ }
18171
+
18172
+ return import('html2canvas');
18173
+
18174
+ })()
18175
+ .catch(function(e) {
18176
+ return Promise.reject(new Error("Could not load dompurify: " + e));
18177
+ })
18178
+ .then(function(html2canvas) {
18179
+ return html2canvas.default ? html2canvas.default : html2canvas;
18180
+ });
18177
18181
}
18178
18182
18179
18183
function loadDomPurify() {
18180
- return loadOptionalLibrary("dompurify", "DOMPurify").catch(function(e) {
18181
- return Promise.reject(new Error("Could not load dompurify: " + e));
18182
- });
18184
+ return (function() {
18185
+ if (globalObject["DOMPurify"]) {
18186
+ return Promise.resolve(globalObject["DOMPurify"]);
18187
+ }
18188
+
18189
+ return import('dompurify');
18190
+
18191
+ })()
18192
+ .catch(function(e) {
18193
+ return Promise.reject(new Error("Could not load dompurify: " + e));
18194
+ })
18195
+ .then(function(dompurify) {
18196
+ return dompurify.default ? dompurify.default : dompurify;
18197
+ });
18183
18198
}
18184
18199
18185
18200
/**
@@ -29776,7 +29791,7 @@ WebPDecoder.prototype.getData = function() {
29776
29791
if (Array.isArray(text)) {
29777
29792
paragraphs = text;
29778
29793
} else {
29779
- paragraphs = text.split(/\r?\n/);
29794
+ paragraphs = String( text) .split(/\r?\n/);
29780
29795
}
29781
29796
29782
29797
// now we convert size (max length of line) into "font size units"
@@ -30221,6 +30236,23 @@ WebPDecoder.prototype.getData = function() {
30221
30236
*/
30222
30237
(function(jsPDFAPI) {
30223
30238
30239
+ function loadCanvg() {
30240
+ return (function() {
30241
+ if (globalObject["canvg"]) {
30242
+ return Promise.resolve(globalObject["canvg"]);
30243
+ }
30244
+
30245
+ return import('canvg');
30246
+
30247
+ })()
30248
+ .catch(function(e) {
30249
+ return Promise.reject(new Error("Could not load dompurify: " + e));
30250
+ })
30251
+ .then(function(canvg) {
30252
+ return canvg.default ? canvg.default : canvg;
30253
+ });
30254
+ }
30255
+
30224
30256
/**
30225
30257
* Parses SVG XML and saves it as image into the PDF.
30226
30258
*
@@ -30275,7 +30307,7 @@ WebPDecoder.prototype.getData = function() {
30275
30307
ignoreDimensions: true
30276
30308
};
30277
30309
var doc = this;
30278
- return loadOptionalLibrary("canvg" )
30310
+ return loadCanvg( )
30279
30311
.then(
30280
30312
function(canvg) {
30281
30313
return canvg.Canvg.fromString(ctx, svg, options);
0 commit comments