My application is written in Flask. The app in Flask runs at mysite.pythonanywhere.com I use python and the pdfkit library to convert the html template to pdf format.
In my development environment I use the version wkhtmltopdf 0.12.6 (with patched qt). When executing the conversion from html to pdf format in the development environment, I get the number of pages and pages correctly displayed in the converted pdf file.
Attached is a screenshot of the section of the document in pdf format that shows 1 of 1 (indicating that it is on page 1 of 1)
When executing the same report and conversion from html to pdf format in the app running at mysite.pythonanywhere.com the page number is not displayed.
Attached is the screenshot of the section of the report where the page number is supposed to be displayed:
As you can see, the page number is not displayed in the file with pdf format that was generated by pdfkit during the conversion from html to pdf format.
After having investigated the possible cause of this behavior when the app is running on the mysite.pythonanywhere.com, I found that the following message is displayed in the mysite.pythonanywhere.com.server.log log file:
2021-07-01 20:26:16 The switch --footer-right, is not support using unpatched qt, and will be ignored.
Investigating the cause of the previously indicated message. I found that the reason for this message is that the version of wkhtmltopdf that I run in the development environment is a version that has the patch qt, and the version of wkhtmltopdf that I run in mysite.pythonanywhere.com is a version that does not have the patch qt.
When executing the command:
$ wkhtmltopdf --version
in development environment, I get version
wkhtmltopdf 0.12.6 (with patched qt)
When executing the command:
$ wkhtmltopdf --version
in production environment, I get version
wkhtmltopdf 0.12.2.4
According to the documentation found on the message displayed on the mysite.pythonanywhere.com server, the message is related to the fact that the version that is running on the server is a version that does not have the qt patch and that is the cause that the number page are not displayed in the pdf file generated by pdfkit
A possible solution found on stackoverflow suggests that it is necessary to install an updated version of wkhtmltopdf, that is, a version that has the qt patch. Error when trying to display the number of pages in PdfKit
The question is: How to update wkhtmltopdf version in pythonanywhere.com virtual environment?
Thank you very much for any guidance you can give.