编译时提示AttributeError: module 'pdfkit.pdfkit' has no attribute 'from_string'

来源:3-10 Word转PDF

半岛王子

2022-08-10 11:35:14

在word转pdf时报错:AttributeError: module 'pdfkit.pdfkit' has no attribute 'from_string'

代码如下:

# coding utf-8

from pdfkit import pdfkit
from pydocx import PyDocX

html = PyDocX.to_html('批复文档.docx')
pdfkit.from_string(html, '批复文档.pdf')

已经安装了pdfkit和wkhtmltopdf。

https://img.mukewang.com/climg/62f3274a0951da3308190270.jpg

写回答

1回答

时间,

2022-08-10

同学,你好!导包语句写错了,直接import pdfkit即可

https://img.mukewang.com/climg/62f32b0d09d639fa04500128.jpg

祝学习愉快!

0

0 学习 · 4469 问题

查看课程