Skip to content

Commit

Permalink
2.1.0
Browse files Browse the repository at this point in the history
* update versions in readme and bower.json to 2.1.0

* update references that were not updated in #2866

* 2.1.0
  • Loading branch information
HackbrettXXX authored Aug 25, 2020
1 parent 078d0fb commit dd6bddd
Show file tree
Hide file tree
Showing 102 changed files with 727 additions and 365 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ yarn add jspdf
Alternatively, load it from a CDN:

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.0.0/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.1.0/jspdf.umd.min.js"></script>
```

Or always get latest version via [unpkg](https://unpkg.com/#/)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jspdf",
"version": "2.0.0",
"version": "2.1.0",
"homepage": "https://github.com/mrrio/jspdf",
"description": "PDF Document creation from JavaScript",
"main": [
Expand Down
92 changes: 62 additions & 30 deletions dist/jspdf.es.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @license
*
* jsPDF - PDF Document creation from JavaScript
* Version 2.0.0 Built on 2020-08-11T07:57:54.902Z
* Version 2.1.0 Built on 2020-08-25T16:02:38.141Z
* CommitID 00000000
*
* Copyright (c) 2010-2020 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
Expand Down Expand Up @@ -3389,16 +3389,16 @@ function jsPDF(options) {

out("xref");
out("0 " + (objectNumber + 1));
out("0000000000 65535 f");
out("0000000000 65535 f ");
for (var i = 1; i <= objectNumber; i++) {
var offset = offsets[i];
if (typeof offset === "function") {
out((p + offsets[i]()).slice(-10) + " 00000 n");
out((p + offsets[i]()).slice(-10) + " 00000 n ");
} else {
if (typeof offsets[i] !== "undefined") {
out((p + offsets[i]).slice(-10) + " 00000 n");
out((p + offsets[i]).slice(-10) + " 00000 n ");
} else {
out("0000000000 00000 n");
out("0000000000 00000 n ");
}
}
}
Expand Down Expand Up @@ -3543,7 +3543,7 @@ function jsPDF(options) {
"<style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style>" +
'<body><iframe id="pdfViewer" src="' +
pdfJsUrl +
'?file=" width="500px" height="400px" />' +
'?file=&downloadName=' + options.filename + '" width="500px" height="400px" />' +
"</body></html>";
var PDFjsNewWindow = globalObject.open();

Expand All @@ -3553,6 +3553,7 @@ function jsPDF(options) {
PDFjsNewWindow.document.documentElement.querySelector(
"#pdfViewer"
).onload = function() {
PDFjsNewWindow.document.title = options.filename;
PDFjsNewWindow.document.documentElement
.querySelector("#pdfViewer")
.contentWindow.PDFViewerApplication.open(
Expand Down Expand Up @@ -6384,7 +6385,7 @@ jsPDF.API = {
* @type {string}
* @memberof jsPDF#
*/
jsPDF.version = "2.0.0";
jsPDF.version = "2.1.0";

/* global jsPDF */

Expand Down Expand Up @@ -11500,9 +11501,13 @@ var AcroForm = jsPDF.AcroForm;
var tempWidth = 0;

if (!Array.isArray(text) && typeof text !== "string") {
throw new Error(
"getTextDimensions expects text-parameter to be of type String or an Array of Strings."
);
if (typeof text === "number") {
text = String(text);
} else {
throw new Error(
"getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings."
);
}
}

const maxWidth = options.maxWidth;
Expand Down Expand Up @@ -18141,18 +18146,6 @@ function Deflater(options) {
}
})(jsPDF.API);

/* eslint-disable no-unreachable */

function loadOptionalLibrary(name, globalName) {
globalName = globalName || name;
if (globalObject[globalName]) {
return Promise.resolve(globalObject[globalName]);
}

return import(name);

}

/**
* @license
* Copyright (c) 2018 Erik Koopmans
Expand All @@ -18171,15 +18164,37 @@ function loadOptionalLibrary(name, globalName) {
(function(jsPDFAPI) {

function loadHtml2Canvas() {
return loadOptionalLibrary("html2canvas").catch(function(e) {
return Promise.reject(new Error("Could not load html2canvas: " + e));
});
return (function() {
if (globalObject["html2canvas"]) {
return Promise.resolve(globalObject["html2canvas"]);
}

return import('html2canvas');

})()
.catch(function(e) {
return Promise.reject(new Error("Could not load dompurify: " + e));
})
.then(function(html2canvas) {
return html2canvas.default ? html2canvas.default : html2canvas;
});
}

function loadDomPurify() {
return loadOptionalLibrary("dompurify", "DOMPurify").catch(function(e) {
return Promise.reject(new Error("Could not load dompurify: " + e));
});
return (function() {
if (globalObject["DOMPurify"]) {
return Promise.resolve(globalObject["DOMPurify"]);
}

return import('dompurify');

})()
.catch(function(e) {
return Promise.reject(new Error("Could not load dompurify: " + e));
})
.then(function(dompurify) {
return dompurify.default ? dompurify.default : dompurify;
});
}

/**
Expand Down Expand Up @@ -29776,7 +29791,7 @@ WebPDecoder.prototype.getData = function() {
if (Array.isArray(text)) {
paragraphs = text;
} else {
paragraphs = text.split(/\r?\n/);
paragraphs = String(text).split(/\r?\n/);
}

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

function loadCanvg() {
return (function() {
if (globalObject["canvg"]) {
return Promise.resolve(globalObject["canvg"]);
}

return import('canvg');

})()
.catch(function(e) {
return Promise.reject(new Error("Could not load dompurify: " + e));
})
.then(function(canvg) {
return canvg.default ? canvg.default : canvg;
});
}

/**
* Parses SVG XML and saves it as image into the PDF.
*
Expand Down Expand Up @@ -30275,7 +30307,7 @@ WebPDecoder.prototype.getData = function() {
ignoreDimensions: true
};
var doc = this;
return loadOptionalLibrary("canvg")
return loadCanvg()
.then(
function(canvg) {
return canvg.Canvg.fromString(ctx, svg, options);
Expand Down
2 changes: 1 addition & 1 deletion dist/jspdf.es.js.map

Large diffs are not rendered by default.

65 changes: 45 additions & 20 deletions dist/jspdf.es.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jspdf.es.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit dd6bddd

Please sign in to comment.