python html内容转写到pdf文件
pip install pdfkit
import pdfkit
import os
def html_to_pdf(content_html, save_path):
"""html转pdf,save_path为pdf绝对路径"""
os.makedirs(os.path.dirname(save_path), exist_ok=True)
pdfkit.from_string(content_html, save_path, options={'encoding': "UTF-8", 'enable-local-file-access': True})