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

Already on GitHub? Sign in to your account

Error: imgData is not defined #301

Closed
bhavikf opened this Issue Jul 7, 2014 · 4 comments

Comments

Projects
None yet
3 participants

bhavikf commented Jul 7, 2014

Hello,

I am trying to convert canvas to Image using HTML2Canvas and then add it to the report but it is ending up with an error as below on line

Error Message in Console:
imgData is not defined

Error at line 514
As per the code line contains the following if condition.

if (imgData.charCodeAt(0) === 0x89 &&

I have attached the file here that is generated by HTML2Canvas in png format.

I am not sure on this code part but possibly it seems that CharCodeAt(0) condition isnt getting validated for PNG file Format.

chartimage

Collaborator

diegocr commented Jul 17, 2014

Does it happens if you use the .addHTML() plugin? See #270

I was running into this too, I think its a result of line 514 in addimage.js

if (imgData.charCodeAt(0) === 0x89 &&
                    imgData.charCodeAt(1) === 0x50 &&
                    imgData.charCodeAt(2) === 0x4e &&
                    imgData.charCodeAt(3) === 0x47  )  format = 'png';

should imgData be imageData ?

Collaborator

diegocr commented Jul 22, 2014

Oh, indeed! nice catch @pmaccamp

/me going to fix it right away

@diegocr diegocr added BUG and removed Support Request labels Jul 22, 2014

@diegocr diegocr closed this in ed1c917 Jul 22, 2014

Collaborator

diegocr commented Jul 22, 2014

On Version 1.0.203 the problem is gone.

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