如何禁用命令提示符wkhtmltopdf?

在我的程序中,我使用wkhtmltopdf.exe将html字符串转换为pdf。当我使用pyinstaller将文件解压缩到.exe时,总是弹出wkhtmltopdf.exe窗口。如何禁用此窗口?

我试图在pdfkit.configuration文件中添加CREATE_NO_WINDOW标志。

if not self.wkhtmltopdf:
    if sys.platform == 'win32':
        self.wkhtmltopdf = subprocess.Popen(
            ['where','wkhtmltopdf'],stdout=subprocess.PIPE,creationflags=0x08000000).communicate()[0].strip()

    else:
        self.wkhtmltopdf = subprocess.Popen(
            ['which',creationflags=0x08000000).communicate()[0].strip() 

以及保存pdf文件的示例代码

 path_wkthmltopdf = r'./wkhtmltopdf.exe'
 config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
 pdfkit.from_string(savepdf(typ_search),os.path.join(path,"sample.pdf"),configuration=config) ```
A008888 回答:如何禁用命令提示符wkhtmltopdf?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3159367.html

大家都在问