Convert a webpage into a picture or pdf--wkhtmltopdf

Source: Internet
Author: User
Tags wkhtmltopdf

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.