问题摘要:我无法让目录生成器在 Python 的 pdfkit 中工作。
我尝试过的:传递参数toc
.
我当前的代码:
toc = {'xsl-style-sheet': 'toc.xsl'}
pdfkit.from_file(
book_html_filename, book_pdf_filename,
configuration=config,
toc=toc,
options=options,cover=cover_html_filename,cover_first=True)
我不熟悉.xsl
根本没有,因此我不知道该文件中应该包含什么内容。
我现在的.xsl
file:
我的意思是它是空的。我收到以下错误消息:
Exception has occurred: OSError
wkhtmltopdf reported an error:
Loading pages (1/6)
[> ] 0%
[===> ] 5%
[======> ] 10%
[==================> ] 30%
[=================================> ] 55%
[=============================================> ] 75%
[============================================================] 100%
Counting pages (2/6)
[===================> ] Object 1 of 3
[============================================================] Object 3 of 3
Error XTSE0010 in file:///C:/Program%20Files/wkhtmltopdf/bin/wkhtmltopdf.exe, at line 1, column 0: Parse error: Premature end of document.
Loading TOC (3/6)
[======> ] 10%
[============================================================] 100%
Error XTSE0010 in file:///C:/Program%20Files/wkhtmltopdf/bin/wkhtmltopdf.exe, at line 1, column 0: Parse error: Premature end of document.
[======> ] 10%
[============================================================] 100%
Resolving links (4/6)
[===================> ] Object 1 of 3
[=======================================> ] Object 2 of 3
[============================================================] Object 3 of 3
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[========> ] Page 1 of 7
[================> ] Page 2 of 7
[=========================> ] Page 3 of 7
[==================================> ] Page 4 of 7
[==========================================> ] Page 5 of 7
[===================================================> ] Page 6 of 7
[============================================================] Page 7 of 7
Done
File "C:\Users\User\Documents\GitHub\SeferMaker\py\create_pdf_with_pdfkit.py", line 40, in <module>
pdfkit.from_file(
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)