'How to use html2canvas and then share the image generated on whatsapp?
I am trying to use html2canvas to generate a snapshot of an html card(which by the way is working properly and the image also gets downloaded properly when I test it on PC) but I need to pass this image to the shareViaWhatsapp function. Not sure which variable stores the generated image so I can pass it directly as the third parameter in this.socialSharing.shareViaWhatsApp("Come join ABCD with me","Subject", imageURL) instead of imageURL .
When I run the apk on phone, I get "URL_NOT_SUPPORTED" error. Please help.
html2canvas(this.screen.nativeElement, {
imageTimeout: 15000, //newline
scale:3, //newline
useCORS: true
}).then(canvas => {
imageURL = canvas.toDataURL("image/jpg");
let a = document.createElement("a");
a.href = imageURL;
a.download = "letter.jpg";
a.click();
this.socialSharing.shareViaWhatsApp("Come join ABCD Community with me","Subject", imageURL)
.then((entries) => {
console.log('success ' + JSON.stringify(entries));
})
.catch((error) => {
alert('error 1' + JSON.stringify(error));
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
