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

Support different image types for toDataURL #16

Closed
neocotic opened this issue Nov 19, 2013 · 3 comments
Closed

Support different image types for toDataURL #16

neocotic opened this issue Nov 19, 2013 · 3 comments
Assignees
Milestone

Comments

@neocotic
Copy link
Owner

More information: http://stackoverflow.com/questions/14383557/setting-canvas-todataurl-jpg-quality

It would make sense to support both the type (and quality?) parameters instead of only PNG.

Here's a currently workaround until this change is implemented, using JPEG as an example:

var dataUrl = qr.canvas(data).toDataURL('image/jpeg');
@ghost ghost assigned neocotic Nov 19, 2013
@richstandbrook
Copy link

This would be good. The work around gives me this error at the moment.

TypeError: 'undefined' is not an object (evaluating 'c.toUpperCase')

http://jsfiddle.net/koorb/U4TXN/4/

@neocotic
Copy link
Owner Author

I'm not familiar with the jsPDF library but I think it should work if you change line 39 to the following:

doc.addImage(dataUrl, 'JPEG');

@richstandbrook
Copy link

Ah, that was a jsPDF error, sorry. Anyway, can't get it working in jsfiddle but it's fine now in my code. Thanks for the workaround.

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

2 participants