Skip to content

Commit 7ef00d4

Browse files
committed
update dom to image to pgn
1 parent fae625b commit 7ef00d4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/dom-to-image.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@
5050
* @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url
5151
* @return {Promise} - A promise that is fulfilled with a SVG image data URL
5252
* */
53-
function toSvg(node, options) {
53+
function toSvg(node, options, loadfonts) {
5454
options = options || {};
5555
copyOptions(options);
5656
return Promise.resolve(node)
5757
.then(function (node) {
5858
return cloneNode(node, options.filter, true);
5959
})
60-
.then(embedFonts)
60+
.then(loadfonts && embedFonts)
6161
.then(inlineImages)
6262
.then(applyOptions)
6363
.then(function (clone) {
@@ -104,8 +104,8 @@
104104
* @param {Object} options - Rendering options, @see {@link toSvg}
105105
* @return {Promise} - A promise that is fulfilled with a PNG image data URL
106106
* */
107-
function toPng(node, options) {
108-
return draw(node, options || {})
107+
function toPng(node, options, loadfonts) {
108+
return draw(node, options || {}, loadfonts || true)
109109
.then(function (canvas) {
110110
return canvas.toDataURL();
111111
});
@@ -149,8 +149,8 @@
149149
}
150150
}
151151

152-
function draw(domNode, options) {
153-
return toSvg(domNode, options)
152+
function draw(domNode, options, loadfonts) {
153+
return toSvg(domNode, options, loadfonts)
154154
.then(util.makeImage)
155155
.then(util.delay(100))
156156
.then(function (image) {

0 commit comments

Comments
 (0)