C++ Docs Printer

Generates PDF from the C++ documentation


2 min, 343 words

Categories: C++


cpp-docs-printer

A Python script to scrape C++ documentation and generate printable PDF documents.

Setup

Linux

Cloning the repository:

#clone the repo
$git clone https://github.com/animesh-chouhan/cpp-docs-printer.git
$cd cpp-docs-printer

Installing the dependencies:

#install python3-pip
$sudo apt-get install python3-pip

#requests
$sudo pip3 install requests

#beautifulsoup4
$sudo pip3 install beautifulsoup4

#weasy-print
$sudo apt-get install build-essential python3-dev python3-pip python3-setuptools python3-wheel python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
$sudo pip3 install WeasyPrint

Running the Python script:

$python3 cplusplus.py http://www.cplusplus.com/reference/cstdio/

Usage example

Sample C++ documentation http://www.cplusplus.com/reference/cstdio/:

Sample pdf generated pdf:

The generated .html and .pdf files are located in the html and pdf folders respectively.

For more examples and usage, please refer to the Wiki.

Built with

  • requests - Requests is an elegant and simple HTTP library for Python, built for human beings.
  • beautifulsoup - Beautiful Soup is a library that makes it easy to scrape information from web pages.
  • weasyprint - WeasyPrint is a smart solution helping web developers to create PDF documents.

Contributing

  1. Fork the repo (https://github.com/animesh-chouhan/cpp-docs-printer/)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

License

MIT License copyright (c) 2020 Animesh Singh Chouhan. Please have a look at the license for more details.