In the Web project, you need to download the Pdf/image feature, and send it as an attachment to the mailbox, with the help of this tool--wkhtmltopdf, the program generated Dynamic Web page HTML stored to the server, and then use it to convert HTML into pdf/image.
Under Windows, test on the command line after the installation is complete:
------> Generate PDF
Take the blog garden as an example
The cnblog.conf is generated under the bin
Open and look.
------> Generate image
or a blog park as an example
D:\wkhtmltopdf\bin>wkhtmltoimage.exe Https://www.cnblogs.com/cnblog.png
The cnblog.png is generated under the bin, the effect is as follows
Of course, you can crop the picture
D:\wkhtmltopdf\bin>wkhtmltoimage.exe--crop-w--crop-h Https://www.cnblogs.com/cnblog1.png
This creates a PNG image of 800*600
You can also specify an offset
D:\wkhtmltopdf\bin>wkhtmltoimage.exe--crop-w--crop-h--crop-x--crop-y Cnblog2.png
Cnblog2.png is the horizontal offset 100px, vertical offset 200px, and then intercept the 800*600 picture
More parameters,--help view (image default maximum width 1024, want to specify a larger width,--width)
------> Calls in PHP
Shell_exec ("D:\wkhtmltopdf\bin\wkhtmltoimage--crop-w 375--crop-h 667 $filename. html $filename. png");
HTML to PDF and image