i have 3 inputs to upload 3 diferent images, i want to validate if 2 of the input have uploaded image, then save as pdf, if i have just 1 can save it to pdf. This is my code of JSPdf:
if(parseInt(img) === 0){
doc.addImage('JPEG', 16,110,85,85);
} else {
doc.addImage(img2, 'JPEG', 110,110,85,85);
doc.addImage(img3, 'JPEG', 16,200,85,85);
}
if(parseInt(img2) === 0){
doc.addImage('JPEG', 110,110,85,85);
} else {
doc.addImage(img, 'JPEG', 16,110,85,85);
doc.addImage(img3, 'JPEG', 16,200,85,85);
}
if(parseInt(img3) === 0){
doc.addImage('JPEG', 16,200,85,85);
} else {
doc.addImage(img, 'JPEG', 16,110,85,85);
doc.addImage(img2, 'JPEG', 110,110,85,85);
}
doc.save('mypdf.pdf');
img, img1 and img2 works if i upload the 3 images at same time but if i upload just 1 or 2 it doesn't work.
When i use this code:
doc.addImage(imagen, 'JPEG', 16,110,85,85);
doc.addImage(imagen2, 'JPEG', 110,110,85,85);
doc.addImage(imagen3, 'JPEG', 16,200,85,85);
Works great but only if ai upload the 3 img at same time, if i try to upload just one or two not working.