Convert a Web page into a picture or PDF document in bulk skill sharing

Source: Internet
Author: User
Tags wkhtmltopdf

At work we sometimes convert some batch pages into images or PDF documents, although most browsers have scrolling screenshots or printouts of PDF documents, but if you have hundreds of dozens of of pages to deal with, it's a human life. So I always want to find a batch to handle the work of the software, but the basic is charged, even if the function is generally charged. Finally, I found wkhtmltopdf this free open source software, the most fitting my work, heartfelt thanks to the software author "Jakob Truelsen" and "Ashish Kulkarni" two great gods! After I installed the software, combined with the Windows Batch command, successfully tested the batch to convert the Web page into pictures and PDF method, now share the following:
First step: Download and install the Wkhtmltopdf software.
Login to the official website of http://wkhtmltopdf.org/, download the software version suitable for your operating system (recommended to download stable version, I test platform for Win7 32-bit, install wkhtmltox-0.12.2.3_ Mingw-w64-cross-win32 version), run cmd,1 after installation is complete:

Figure 1

Step Two: Collect the required URLs in Excel and prepare the batch files for processing.
The main purpose of using Excel is to facilitate the collection of different URLs, batch generation of the target file name, batch generation through the formula command, 2:

Figure 2
The Excel table in Figure 2 needs to be aware that the F column is set to wrap, and the F column formula is =b2&char &C2& "&D2&" &e2, where CHAR (10) is a newline character, The web address is enclosed in double quotation marks of the English half angle.

Step three: Make a batch file.
Create a new folder, the output of the file will also be stored here, a new Notepad document, named Htmltoimage.bat, opened with Notepad, first enter:
@echo off
Path C:\Program Files\wkhtmltopdf\bin
.........................................
Pause
Because the batch commands in Excel are pasted directly into ... there is no line break between the commands, so you can go through word, paste it into Word, paste it into the batch file ..., save it, run it, and get it done!! 3:

Figure 3

Conclusion: The above demo is to convert the Web page into a picture, if it is converted into a PDF document, simply change the command wkhtmltoimage to Wkhtmltopdf.
Finish

Convert a Web page into a picture or PDF document in bulk skill sharing

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.