21
Views
5
Comments
[Html 2 Image] Does not support IOS.
Forge component by Romel Guerra
3
Published on 14 Jan 2020

This component is working amazing on android but is at all not supporting IOS. It does not throw any error too. We tried with 3 4 iphones and none of them worked.
I saw one more post of this same issue on this component.
Anyone able to figure this out?
 

Thanks,
Anagha 

Rank: #39142

Any luck making it work on iOS?

Rank: #3412

Hello Sergio,
No the component did not worked for us and we got it done with javascript.

Thanks,
Anagha 


Rank: #39142

Did you use the same script from http://html2canvas.hertzen.com/  on your javascript solution?

Thanks,

Sérgio


Anagha Chikate wrote:

Hello Sergio,
No the component did not worked for us and we got it done with javascript.

Thanks,
Anagha 


 

 

Rank: #7833

Hi Anagha,

Can you share your solution?

Thanks,

Diogo.

Rank: #3412

Hey,
Sorry for replying so late.
You can try the below javascript for mobile.

var tCtx;
var img;
function textToImage (){
img = document.createElement('image');
img.id = "my-image";
document.getElementsByClassName('output')[0].appendChild(img);
var canvas = document.createElement('canvas');
tCtx = canvas.getContext("2d");
tCtx.textAlign = "center";
canvas.height = 60;
canvas.width=300;
document.getElementsByClassName('output')[0].appendChild(canvas);
tCtx.fillText(document.getElementsByClassName('my-input')[0].value, 10, 40);
img.src = tCtx.canvas.toDataURL();
}


This script basically creates a canvas and converts your text from my-input into an image using toDateURL function.
Now call this function as javascript funtion is any action, so that you will get your image in the attribute that is img.src.
Get the output of this javascript function by assigning it to an output variable like
Output =JavaScript.outputImage where outputImage being the output parameter of the script.
Just make sure you name the css elements properly.

Hope this helps.
Anagha