First, download and install Wkhtmltopdf
Https://wkhtmltopdf.org/downloads.html
You can download and install the installation as needed;
Ii. use steps-start and generate images or PDFs
1. Download Wkhtmltopdf
2.which wkhtmltopdf
3.wkhtmltoimage www.baidu.com /users/liufeifei/downloads/name.jpg
3.wkhtmltopdf-s A4 www.baidu.com /users/liufeifei/downloads/name.pdf
Three, paging or cropping in a fixed position
Wkhtmltopdf is very useful, but it is also somewhat unsatisfactory. is when an HTML page is a long I need to be paged in the specified place.
Wkhtmltopdf developers did not take this into account at the time of development,
Wkhtmltopdf a good way to do that is to add one after that Div's style: page-break-inside:avoid; it's OK.
For example:
div{width:800px;height:700px;page-break-inside:avoid;}
Convert a webpage into a picture or pdf--wkhtmltopdf