Skip to content

Commit ea1e5ce

Browse files
committed
addImage: 'format' does not really needs to be required, just assume it's JPEG
1 parent 9baf701 commit ea1e5ce

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

jspdf.plugin.addimage.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ var getJpegSize = function(imgData) {
140140

141141
jsPDFAPI.addImage = function(imageData, format, x, y, w, h) {
142142
'use strict'
143+
if(typeof format === 'number') {
144+
var tmp = h;
145+
h = w;
146+
w = y;
147+
y = x;
148+
x = format;
149+
format = tmp || 'JPEG';
150+
}
143151
if(typeof imageData === 'string' && imageData.substr(0,14) === 'data:image/jpg') {
144152
imageData = imageData.replace('data:image/jpg','data:image/jpeg');
145153
}

0 commit comments

Comments
 (0)