【发布时间】:2019-12-17 13:03:50
【问题描述】:
我在 python 中创建了一个 GUI 程序来创建 pdfs。我正在使用 pdfkit 库来创建 pdfs:
options = {
'page-size': 'A4',
'margin-top': '0.3in',
'margin-bottom': '0.3in',
'margin-left': '0.5in',
'margin-right': '0.4in',
'quiet': '',
'orientation' : 'Landscape'
}
toc = {
'xsl-style-sheet': 'toc.xsl'
}
path_wkhtmltopdf = r'wkhtmltopdf\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
pdfkit.from_string(htmlString, reportPath, configuration=config, toc=toc, options = options)
为了使我的 GUI 程序可执行,我使用了pyinstaller。
当我使用这个 .exe 文件时,它会在创建 pdf 期间弹出 wkhtmltopdf.exe 的 cmd 窗口。我怎样才能停止弹出?上网查了一下,没找到解决办法。
【问题讨论】:
-
我无法弄清楚如何使用目录。你能帮助我吗?我假设我需要一个 .xsl 文件。但我不太了解那种文档类型,也不知道我应该在那里放什么。谢谢!
标签: python python-3.x popup wkhtmltopdf pdfkit