javascript 打印您的网页屏幕并发送带有打印图像的电子邮件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10957530/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Print your webpage screen and send email with printed image
提问by Annette
Possible Duplicate:
Capture HTML Canvas as gif/jpg/png/pdf?
Is there a simple way to create JS onclick function which will print the current screen of the website, save it as the image (.jpg or something) and send it via email.
有没有一种简单的方法来创建 JS onclick 函数,该函数将打印网站的当前屏幕,将其保存为图像(.jpg 或其他格式)并通过电子邮件发送。
I would like to create this option for the user side so there is no need for user to use keyboard 'Prnt Scr', then open Paint and paste and 'save as' an image, then attach and send via email.
我想为用户端创建此选项,因此用户无需使用键盘“Prnt Scr”,然后打开“画图”并粘贴并“另存为”图像,然后附加并通过电子邮件发送。
Thanks in advance!
提前致谢!
回答by Zuul
There are a few solutions out there:
有几种解决方案:
Converting a webpage to an image using
wkhtmltox
:Make use of the
HTMLCanvasElement
object'stoDataURL
function:The
html2canvas
script:Using the PHP
wkhtmltoimage
:
使用以下方法将网页转换为图像
wkhtmltox
:使用
HTMLCanvasElement
对象的toDataURL
功能:该
html2canvas
脚本:使用 PHP
wkhtmltoimage
:
ps:a simple Google searchgives you all of this!
ps:一个简单的谷歌搜索就可以为您提供这一切!