Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use html2canvas proxy

I'm using html2canvas plugin to generate snapshot of web pages. The problem is that everything runs ok in the localhost, however when deployed on the remote server I get the following error : Unable to get image data from canvas because the canvas has been tainted by cross-origin data.

I've found a plugin that is supposed to work : https://github.com/niklasvh/html2canvas-proxy

The problem is that I don't know how to use it !

Similar question is asked here but remains without answer : https://github.com/niklasvh/html2canvas/issues/61

like image 875
amine Avatar asked Mar 22 '12 15:03

amine


1 Answers

I've solved this issue, the proxy code needs to be added to the server side scripts. Then I needed to change the order of if statements to make calling the proxy the first choice since it will be the case for all the images we are dealing with in our project. Thanks Niklas. More details are here : https://github.com/niklasvh/html2canvas-proxy/issues/2#

like image 170
amine Avatar answered Sep 19 '22 21:09

amine