You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
addImage function is used to merge multiple images to PDF. This was working as expected earlier but recently the same code started resulting blur images for the same source images used earlier. Need help understanding this random behaviour.
Source code:
let freader = new FileReader(); freader.onload = f => { base64DataURL = freader.result; let imgVar = new Image(); imgVar.onload = (() => { let aspectRatio = 0.3; let context = canvas.getContext('2d'); canvas.width = imgVar.width * aspectRatio; canvas.height = imgVar.height * aspectRatio; context.drawImage(imgVar, 0, 0, canvas.width, canvas.height); let data = canvas.toDataURL(file.type, aspectRatio); let fileStart = data.indexOf(base64) + base64.length; base64File = data.substring(fileStart); this.filesUploaded.push({ Title: file.name, VersionData: encodeURIComponent(base64File), Width: canvas.width, Height: canvas.height, Format: file.type }); }); imgVar.src = base64DataURL; }; freader.readAsDataURL(file);
The text was updated successfully, but these errors were encountered:
jsPDF version used - 2.3.0
addImage function is used to merge multiple images to PDF. This was working as expected earlier but recently the same code started resulting blur images for the same source images used earlier. Need help understanding this random behaviour.
Source code:
let freader = new FileReader(); freader.onload = f => { base64DataURL = freader.result; let imgVar = new Image(); imgVar.onload = (() => { let aspectRatio = 0.3; let context = canvas.getContext('2d'); canvas.width = imgVar.width * aspectRatio; canvas.height = imgVar.height * aspectRatio; context.drawImage(imgVar, 0, 0, canvas.width, canvas.height); let data = canvas.toDataURL(file.type, aspectRatio); let fileStart = data.indexOf(base64) + base64.length; base64File = data.substring(fileStart); this.filesUploaded.push({ Title: file.name, VersionData: encodeURIComponent(base64File), Width: canvas.width, Height: canvas.height, Format: file.type }); }); imgVar.src = base64DataURL; }; freader.readAsDataURL(file);
The text was updated successfully, but these errors were encountered: