import os
import re
#from weasyprint import HTML # https://weasyprint.readthedocs.io/en/stable/tutorial.html
#https://builds.wkhtmltopdf.org/0.12.1.4/
#Download Page for libpng12-0_1.2.54-1ubuntu1.1_amd64.deb on AMD64 machines
#You should be able to use any of the listed mirrors by adding a line to your /etc/apt/sources.list like this:
#deb http://security.ubuntu.com/ubuntu xenial-security main
import glob, os
os.chdir("/home/www/wwwsamystocks/ressources/symbols/MSFT")
for file in glob.glob("*.htm"):
print("Bearbeite htm Datei:",file)
f = open(file, 'r')
r = f.read() # python will convert \n to os.linesep
f.close() # you can omit in most cases as the destructor will call it
myNewFile = file.replace("htm","pdf")
#print("Schreibe PDF Datei:",myNewFile)
#html = HTML(string=r)
#html.write_pdf(myNewFile)
os.system("wkhtmltopdf "+file+" "+myNewFile)
exit(1)