我的 django 应用程序中有一个模板,我需要将它呈现在一个变量中或将其保存在一个 html 文件中。
我的目标是将模板的 html 渲染转换为 pdf,我正在使用 pdfkit,因为它是我见过的最好的 html 到 pdf 转换器,reportlab 没有做我想要的。
当我尝试做这样的事情时:
pdf = pdfkit.from_file ('app / templates / app / table.html', 'table.pdf')
Run Code Online (Sandbox Code Playgroud)
我得到了 pdf,但打印出如下内容:
我感谢任何帮助!