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

ERROR DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported. #17

Open
TongZhai opened this issue Jul 3, 2020 · 1 comment

Comments

@TongZhai
Copy link

TongZhai commented Jul 3, 2020

I used the following tag to load the image:

<aia-image-annotator #annotator 
      [image]="myImage" 
      [fontSize]="'36px'" 
      [fontFamily]="'Times'" 
      [color]="'#000000'">
</aia-image-annotator>

I used the following function in my component to save the return Url from getAnnotatedImage() function call:

save() {
    let saved = this.annotator.getAnnotatedImage('image/png');
    if (saved)
      this.mySavedImage = saved;
}

but it failed with the following error:

ERROR DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
    at AiaImageAnnotatorComponent.getAnnotatedImage (http://localhost:4200/vendor.js:71813:28)
    at AppComponent.save (http://localhost:4200/main.js:168:36)
    at AppComponent_Template_button_click_171_listener (http://localhost:4200/main.js:493:147)
    at executeListenerWithErrorHandling (http://localhost:4200/vendor.js:26822:16)
    at wrapListenerIn_markDirtyAndPreventDefault (http://localhost:4200/vendor.js:26864:22)
    at HTMLButtonElement.<anonymous> (http://localhost:4200/vendor.js:60166:38)
    at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:412:35)
    at Object.onInvokeTask (http://localhost:4200/vendor.js:44161:33)
    at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:411:40)
    at Zone.runTask (http://localhost:4200/polyfills.js:180:51)

I tried to save when it has not been edited, it failed the same way. Is the save function implemented in this tool?

@shijukrishnan
Copy link

Hi @TongZhai, I was trying to use this package, but finally ended up on the same error. Seems it does not support image urls. Sorry I know its very long back, just in case if you remember, please let me know if you find any solutions that day.
Thanks,
Shiju

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