Crawl online tutorials with Python! and convert it to PDF for easy learning!

Source: Internet
Author: User
Tags wkhtmltopdf








1. Website Introduction


You will often be redirected to an online tutorial as shown in the previous search for information:






01. Tutorial Styles



Some github projects include links to this site. After a search, the site is a Web site that can create, host, and browse documents at: https://readthedocs.org. A lot of good resources can be found on top.



Although the site provides download functionality, some tutorials do not provide PDF file downloads,






02. Download



This tutorial only provides the download of HTML format files, or is not very convenient to consult, so let us turn it into a PDF!






$ sudo apt-get install wkhtmltopdf # Ubuntu



$ sudo yum intsall wkhtmltopdf # CentOS






























3.3 Getting chapter Content



Or the same way to locate the chapter content:












3.4 Save PDF






3.5 Merging PDFs



After the last step, all the chapters are saved in PDF, and finally we want to leave a PDF, we need to merge all the PDFs and delete the individual chapter PDF.






Originally PyPDF2 Library has a classPdfFileMergerspecifically used to merge PDFs, but in the merger process will throw an exception, online someone also encountered the same problem, the solution is to modify the library source code, the spirit of "Fixed library source code" concept, resolutely chose the above this relatively stupid method, the code is relatively good understanding.



After the above steps, we want the PDF file has been generated, together to enjoy the fruits of labor:





06. Saving Results


Welcome everyone to follow my blog: https://home.cnblogs.com/u/sm123456/Interactive Communication in the blog park



Welcome to join thousands of people to communicate questions and Answers group: 125240963



Crawl online tutorials with Python! and convert it to PDF for easy learning!


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.