Converting HTML files into PDFs using Python

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Once I was asked to read Swift docs and give a demo on the same. As you can see this docs is only HTML and no PDF version is available. It's itching to read HTMLs for a long time, and I personally prefer PDFs. Wanted to fetch all the doc pages and convert it to PDF. Here's how we can easily (read 'naive') do it using pdfkit.

P.S: swift_links.txt is my local file which has all the relevant links from the docs URL. How to extract links from a webpage? Different story ~ read here.

P.P.S: Have never checked about the copyright issue. Never transport the PDF unless you're quite sure it doesn't violate their policies.

Want to merge these files? Check it out here.