import pdfkit import os path_wkthmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe' config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf) os.chdir('C:\Users\jborthen\Desktop') pdfkit.from_url("https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-2.html", "out2.pdf", configuration=config) ''' http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-1.html ''' ### The following merges multiple pdfs into one: # Loading the pyPdf Library from pyPdf import PdfFileWriter, PdfFileReader # Creating a routine that appends files to the output file def append_pdf(input,output): [output.addPage(input.getPage(page_num)) for page_num in range(input.numPages)] # Creating an object where pdf pages are appended to output = PdfFileWriter() # Appending two pdf-pages from two different files append_pdf(PdfFileReader(open("C:\Users\jborthen\Desktop\PDF_Merge\out1.pdf","rb")),output) append_pdf(PdfFileReader(open("C:\Users\jborthen\Desktop\PDF_Merge\out2.pdf","rb")),output) # Writing all the collected pages to a file output.write(open("CombinedPages.pdf","wb"))