Skip to content

Commit dd6bddd

Browse files
authored
2.1.0
* update versions in readme and bower.json to 2.1.0 * update references that were not updated in #2866 * 2.1.0
1 parent 078d0fb commit dd6bddd

File tree

102 files changed

+727
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+727
-365
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ yarn add jspdf
2929
Alternatively, load it from a CDN:
3030

3131
```html
32-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.0.0/jspdf.umd.min.js"></script>
32+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.1.0/jspdf.umd.min.js"></script>
3333
```
3434

3535
Or always get latest version via [unpkg](https://unpkg.com/#/)

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspdf",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"homepage": "https://github.com/mrrio/jspdf",
55
"description": "PDF Document creation from JavaScript",
66
"main": [

dist/jspdf.es.js

+62-30
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @license
22
*
33
* 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
55
* CommitID 00000000
66
*
77
* Copyright (c) 2010-2020 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
@@ -3389,16 +3389,16 @@ function jsPDF(options) {
33893389

33903390
out("xref");
33913391
out("0 " + (objectNumber + 1));
3392-
out("0000000000 65535 f");
3392+
out("0000000000 65535 f ");
33933393
for (var i = 1; i <= objectNumber; i++) {
33943394
var offset = offsets[i];
33953395
if (typeof offset === "function") {
3396-
out((p + offsets[i]()).slice(-10) + " 00000 n");
3396+
out((p + offsets[i]()).slice(-10) + " 00000 n ");
33973397
} else {
33983398
if (typeof offsets[i] !== "undefined") {
3399-
out((p + offsets[i]).slice(-10) + " 00000 n");
3399+
out((p + offsets[i]).slice(-10) + " 00000 n ");
34003400
} else {
3401-
out("0000000000 00000 n");
3401+
out("0000000000 00000 n ");
34023402
}
34033403
}
34043404
}
@@ -3543,7 +3543,7 @@ function jsPDF(options) {
35433543
"<style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style>" +
35443544
'<body><iframe id="pdfViewer" src="' +
35453545
pdfJsUrl +
3546-
'?file=" width="500px" height="400px" />' +
3546+
'?file=&downloadName=' + options.filename + '" width="500px" height="400px" />' +
35473547
"</body></html>";
35483548
var PDFjsNewWindow = globalObject.open();
35493549

@@ -3553,6 +3553,7 @@ function jsPDF(options) {
35533553
PDFjsNewWindow.document.documentElement.querySelector(
35543554
"#pdfViewer"
35553555
).onload = function() {
3556+
PDFjsNewWindow.document.title = options.filename;
35563557
PDFjsNewWindow.document.documentElement
35573558
.querySelector("#pdfViewer")
35583559
.contentWindow.PDFViewerApplication.open(
@@ -6384,7 +6385,7 @@ jsPDF.API = {
63846385
* @type {string}
63856386
* @memberof jsPDF#
63866387
*/
6387-
jsPDF.version = "2.0.0";
6388+
jsPDF.version = "2.1.0";
63886389

63896390
/* global jsPDF */
63906391

@@ -11500,9 +11501,13 @@ var AcroForm = jsPDF.AcroForm;
1150011501
var tempWidth = 0;
1150111502

1150211503
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+
}
1150611511
}
1150711512

1150811513
const maxWidth = options.maxWidth;
@@ -18141,18 +18146,6 @@ function Deflater(options) {
1814118146
}
1814218147
})(jsPDF.API);
1814318148

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-
1815618149
/**
1815718150
* @license
1815818151
* Copyright (c) 2018 Erik Koopmans
@@ -18171,15 +18164,37 @@ function loadOptionalLibrary(name, globalName) {
1817118164
(function(jsPDFAPI) {
1817218165

1817318166
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+
});
1817718181
}
1817818182

1817918183
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+
});
1818318198
}
1818418199

1818518200
/**
@@ -29776,7 +29791,7 @@ WebPDecoder.prototype.getData = function() {
2977629791
if (Array.isArray(text)) {
2977729792
paragraphs = text;
2977829793
} else {
29779-
paragraphs = text.split(/\r?\n/);
29794+
paragraphs = String(text).split(/\r?\n/);
2978029795
}
2978129796

2978229797
// now we convert size (max length of line) into "font size units"
@@ -30221,6 +30236,23 @@ WebPDecoder.prototype.getData = function() {
3022130236
*/
3022230237
(function(jsPDFAPI) {
3022330238

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+
3022430256
/**
3022530257
* Parses SVG XML and saves it as image into the PDF.
3022630258
*
@@ -30275,7 +30307,7 @@ WebPDecoder.prototype.getData = function() {
3027530307
ignoreDimensions: true
3027630308
};
3027730309
var doc = this;
30278-
return loadOptionalLibrary("canvg")
30310+
return loadCanvg()
3027930311
.then(
3028030312
function(canvg) {
3028130313
return canvg.Canvg.fromString(ctx, svg, options);

dist/jspdf.es.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.es.min.js

+45-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.es.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)