PyQt5 creating pdfs using pdfkit - wkhtmltopdf.exe window popup with each pdf

229 views Asked by At

I've built an application using PyQt5 to process some data and generate a pdf report using pdfkit. If I run the application through PyCharm this works well. I've packaged the application into an executable using fman build system (PyInstaller wrapper) and when I run it, a wkhtmltopdf.exe console window pops up every time a pdf is generated.

This is really annoying when processing many files.

Is there a way to ensure wkhtmltopdf.exe only ever opens as a minimized window (or similar solution)?

1

There are 1 answers

0
ChiPhi85 On

In the end I resorted to forking pdfkit from GitHub and adding creationflags=0x08000000 in the Popen functions in the configuration.py and pdfkit.pyfiles. I knew I would be passing the wkhtmltopdf.exe location to the configuration file so I made this explicit as well.

It's available at https://github.com/KiFi85/python-pdfkit

It worked for me but not sure if it's the best solution