Created
January 1, 2020 14:36
-
-
Save e96031413/55448ee37c0843b23a6259a9e9375982 to your computer and use it in GitHub Desktop.
how to convert html files into a single pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob,os | |
import pdfkit #pip install pdfkit | |
path = r"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" | |
config = pdfkit.configuration(wkhtmltopdf=path) | |
newList=[] | |
for filename in glob.iglob(os.path.join('*.html')): | |
newList.append(filename) | |
pdfkit.from_file(newList, 'out.pdf', configuration=config) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment