Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged PDF is blur as compared to the source images used #3717

Open
vsvikram opened this issue Mar 26, 2024 · 0 comments
Open

Merged PDF is blur as compared to the source images used #3717

vsvikram opened this issue Mar 26, 2024 · 0 comments

Comments

@vsvikram
Copy link

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant