I can see in the console that addImage()
function of jspdf library has 9 parameters. I've seen people using first 5 of them, but not completely sure even about them. Unfortunately, documentation for this method is not provided on official web-site. Also, corresponding github issues are closed.
From the source you can find the method signature as follows:
function(imageData, format, x, y, w, h[, alias[, compression[, rotation]]])
imageData
has to be:
ImageData
object<img>
element<canvas>
elementdata uri
imageData
property (with one of the above data types)format
has to be:
'jpeg', 'jpg', 'png'
If the type is not string
then the script acts like the function has the following signature (format
is now the sixth parameter):
function(imageData, x, y, w, h[, format[, alias[, compression[, rotation]]]])
where format
would have a default value of jpeg
x
and y
have to be:
w
and h
have to be:
alias
(optional) has to be:
undefined
or null
In this case the unique identifier is a hash of the imagecompression
(optional) has to be:
compression
to NONE
rotation
(optional, only relevant when imageData
is a DOM element) has to be:
angle
)x
and y
) (optional, default: center of the canvas)bg
) (optional, default: 'white'
)The answer is based on the code available here.
If there are any errors or missing information feel free to add them :)