我在终端手动启动项目 python manage.py runserver 没问题
代码如下
import imgkit
path_wkimg = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltoimage.exe' # 工具路径
cfg = imgkit.config(wkhtmltoimage=path_wkimg)
options = {"encoding": "UTF-8"} # 这个具体要看你那个 html 页面到底是以什么编码格式保存的
if not prefix:
prefix = str(uuid.uuid4())
img_file_path = r'd:\xx.png'
imgkit.from_string(html_str, img_file_path, config=cfg, options=options)
代码如下
import imgkit
path_wkimg = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltoimage.exe' # 工具路径
cfg = imgkit.config(wkhtmltoimage=path_wkimg)
options = {"encoding": "UTF-8"} # 这个具体要看你那个 html 页面到底是以什么编码格式保存的
if not prefix:
prefix = str(uuid.uuid4())
img_file_path = r'd:\xx.png'
imgkit.from_string(html_str, img_file_path, config=cfg, options=options)