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.
1 2 3 4 5 6 7 8 |
import pdfkit filecount=1 with open("swift_links.txt") as f: links = f.read().split("\n") for each_link in links: filename = str(filecount)+".pdf" pdfkit.from_url(each_link, filename) filecount = filecount+1 |
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.