cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shraddha113
New Member

Html canvas element in pcf control

Hi all,

 

I am trying to use HTML canvas element in pcf control by using typescript code. But, I cannot access canvas.toDataURL() function in pcf control. It gives me an error like:

Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

I have also tried

 var mapCanvas = document.createElement('canvas'as HTMLCanvasElement;
but it gives same error.Can someone tell me the solution of these? Is pcf support canvas element?
 
Thanks!
3 REPLIES 3
v-yutliu-msft
Community Support
Community Support

Hi @Shraddha113 ,

Do you want to export image by using command like this: canvas.toDataURL("image/png")?

If so, this is supported in pcf. The problem should be about your code.

You need to set crossOrigin for the image outside the onload function.

Here's a similar issue for your reference:

https://stackoverflow.com/questions/43310565/failto-execute-todataurl-on-htmlcanvaselement

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

Yes. I have try this also but it still gives the same error. So, is there some other way?

Hi @Shraddha113 ,

Since I did not met the same problem before, I don't quite know where's the problem.

I'm sorry that I am not quite familiar with pcf, I suggest you open a ticket here:

https://powerapps.microsoft.com/en-us/support/pro/ticket/

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,574)