You need to sign in to do that
Don't have an account?

How to take the screen shot of the page
Hello Every one,
When i click on a button in visualforce page, it has to capture the screenshot of the page and it has to send an email to some user. How can i achieve this?? I tried in different ways but strucked in some protions. Will you share your idea or any solution for this.
Thanks in advance !!
When i click on a button in visualforce page, it has to capture the screenshot of the page and it has to send an email to some user. How can i achieve this?? I tried in different ways but strucked in some protions. Will you share your idea or any solution for this.
Thanks in advance !!
Create a contoller that send an email with attachment.
We will decode the string using EncodingUtil.base64Decode then add into attachment body
and send email with that attachment.
In page onload on window we will create canvas image using html2canvas
then once page is load click on button this will send an email with attach image.
If this solve you problem mark this as best answer to help others.
All Answers
You can use HTML2Canvas http://html2canvas.hertzen.com/
For Reference use this http://sforcedc.blogspot.in/2015/06/visualforce-page-screenshots-with.html
Try this.
Thanks in advance!!
onclick of button call a js function
bind this strURl to a apex variable at controller side for this you can use apex function with parem
action function will call a method
try this....
Can you give a littile more idea on Visualroce page that how to add canvas tag and passing paramers in actiofunction.
Please suggest, with your valuable idea. Thanks in advance!!
Create a contoller that send an email with attachment.
We will decode the string using EncodingUtil.base64Decode then add into attachment body
and send email with that attachment.
In page onload on window we will create canvas image using html2canvas
then once page is load click on button this will send an email with attach image.
If this solve you problem mark this as best answer to help others.
1. once page load. Canvas2HTML convert the page into a canvas image.
2. Onclick on button we get the canvas image DataURL and assign to controller variable strImageBlob.
3. And onclick of button we call controller method for sending email.
4. In this method we create image/png attachment.
5 In attachment body we decode the canvas data and before that wwe replace the data:image/png;base64 with '' space else it wont decode.
6. After that we are sending email to specify email address with attach image.
Its working fine, Thank you very much for your help on this.
Regards,
Swamy
I just want to know only one thing that is, am not able to see the radio buttons in the screenshot image. Please see the below image for better understanding. To show radio buttons as well, what we have to add because user has to know which one they selected by looking into that email.
Just use the updated html2Canvas.js file this will work with checkbox also.
Atlast i just wanted to ask you onething i.e, If i commented that appendChild line, am not able to send an email to the users.
Internal team was not supposed to see the screeshot while sending. If i uncommented that line, than am able to send an emai to the users.
useCORS: true, onrendered: function(canvas) {
// document.body.appendChild(canvas);
// document.getElementById("mapDiv").style.display = 'none';
}
So while we are sending an email, Internal team people are not supposed to see that screenshot, only the users have to see the image which is in thier email. How can i achieve this?? and also i just want to hide some part in that page.. how can i achieve these buddy, suggest me.
Thanks in advance!!
I am not sure but you can give a try.
I think instead of generating the canvas onload of page. generate canvas onclick on button and before generating the canvas you can hide the div using javascript.
Once canvas is genrated then you can call the apex function use apex function oncomplete attribute here..
Once email is sent after that you can call a javascript function from using oncomplete attribute.
In that javascript function you can hide the canvas.
let me know if this will work or not.
Actually it was resolved.
For hiding some components in the page, you have to pass the attribute:: <div data-html2canvas-ignore="true">
For hiding appended child in the page, you have to use below snippet of code in script.
{
document.body.appendChild(canvas);
canvas.style.visibility = 'hidden';
},
Thanks for helping on this requirement, it is completed successfully. :) :)
can u please tell me how to save screenshot in a object or folder.
I am trying to get screenshot of Rich Text Area Field which contains images.
I got below error.
I did CORS setting for this but still getting same issue.
please suggest me any solution.