Skip to content

Commit 8c67850

Browse files
committed
Ignore exception when calling toPixels()
1 parent fb50783 commit 8c67850

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

libs/canvg_context2d/canvg.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3238,11 +3238,16 @@
32383238
}
32393239
//ss end
32403240

3241-
if (svg.opts['ignoreDimensions'] == true && e.style('width').hasValue() &&
3242-
e.style('height').hasValue()) {
3243-
cWidth = e.style('width').toPixels('x');
3244-
cHeight = e.style('height').toPixels('y');
3245-
}
3241+
//ss
3242+
if (svg.opts['ignoreDimensions'] == true && e.style('width').hasValue() && e.style('height').hasValue()) {
3243+
try {
3244+
cWidth = e.style('width').toPixels('x');
3245+
cHeight = e.style('height').toPixels('y');
3246+
} catch (e) {
3247+
// This will always fail with jsPDF, as no viewport is set
3248+
}
3249+
}
3250+
//ss end
32463251
svg.ViewPort.SetCurrent(cWidth, cHeight);
32473252

32483253
if (svg.opts['offsetX'] != null) e.attribute('x', true).value = svg.opts[

0 commit comments

Comments
 (0)