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

Closed
vsvikram opened this issue Mar 26, 2024 · 1 comment
Closed

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

vsvikram opened this issue Mar 26, 2024 · 1 comment

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

Copy link

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

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

No branches or pull requests

1 participant