Skip to content

Commit

Permalink
Fix for [fuzhenn#43] document not found.
Browse files Browse the repository at this point in the history
An addition for fuzhenn#48: createCanvas is not enough, need to pass createImage to work with embedded images.
  • Loading branch information
lobovkin authored Mar 25, 2021
1 parent 10e15df commit 9b060a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function convert(svgContent, options, callback) {
var canvas = Canvas.createCanvas(options.width||100, options.height||100);
var ctx = canvas.getContext('2d');
try {
const renderer = canvg.Canvg.fromString(ctx, svgContent, { DOMParser: jsdomWindow.DOMParser, window: jsdomWindow, ignoreMouse: true, ignoreAnimation: true, createCanvas: Canvas.createCanvas, ImageClass: Canvas.Image });
const renderer = canvg.Canvg.fromString(ctx, svgContent, { DOMParser: jsdomWindow.DOMParser, window: jsdomWindow, ignoreMouse: true, ignoreAnimation: true, createCanvas: Canvas.createCanvas, createImage: Canvas.loadImage, ImageClass: Canvas.Image });
await renderer.render();
} catch (error) {
callback(error);
Expand Down

0 comments on commit 9b060a3

Please sign in to comment.