how to install wkhtmltopdf with patched qt in bench
i installed wkhtmltopdf but it is not with patched qt
how to install wkhtmltopdf with patched qt in bench
i installed wkhtmltopdf but it is not with patched qt
sudo apt-get install xvfb libfontconfig wkhtmltopdf
sudo apt-get install libmysqlclient-dev
hey @rs115199789 ,
i installed wkhtmltopdf following below steps
add wkhtmltopdf to the pyproject.toml
pip install wkhtmltopdf
so should i uninstall it and then do
sudo apt-get install xvfb libfontconfig wkhtmltopdf
sudo apt-get install libmysqlclient-dev
I just need to entered above commands in bench right?
Yes you need to enter those commands only in the bench , and also if you facing issue then re-install might work for you.
xvfb
, libfontconfig
, wkhtmltopdf
): Installs packages necessary for running wkhtmltopdf
to convert HTML to PDF format, including a virtual display server (xvfb
) and font configuration library (libfontconfig
).libmysqlclient-dev
): Installs development files required for compiling programs that interact with MySQL databases, providing necessary libraries and headers.hey @rs115199789,
wkhtmltopdf --version
returns
wkhtmltopdf 0.12.6
but it should return
wkhtmltopdf 0.12.6(with pacthed qt)
am i right?
but both these commands are successfully executed
sudo apt-get install xvfb libfontconfig wkhtmltopdf
sudo apt-get install libmysqlclient-dev
so what might be the issue?
sudo apt remove wkhtmltopdf
You need to download the version of wkhtmltopdf that includes patched Qt libraries.
get https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
**adjust the URL based on the version you need. Ensure it includes “bionic_amd64.deb” if you’re using Ubuntu 18.04 (Bionic).
Install the downloaded package:
Install the downloaded package using dpkg:
sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
wkhtmltopdf --version
bench get https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
returns
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: git clone https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb --depth 1 --origin upstream
remote: Not Found
fatal: repository 'https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb/' not found
why it is saying remote not found
Follow the instructions @rs115199789 posted above after downloading the appropriate .deb for your distribution:
sudo dpkg -i /path/to/the/downloaded/deb
i was also getting this error,
i did as per this guide ,
and now its properly installed – wkhtmltopdf 0.12.6.1 (with patched qt)
but i am getting this error while generating pdf now
recent call last):
File “apps/frappe/frappe/utils/pdf.py”, line 92, in get_pdf
filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
File “env/lib/python3.10/site-packages/pdfkit/api.py”, line 75, in from_string
return r.to_pdf(output_path)
File “env/lib/python3.10/site-packages/pdfkit/pdfkit.py”, line 201, in to_pdf
self.handle_error(exit_code, stderr)
File “env/lib/python3.10/site-packages/pdfkit/pdfkit.py”, line 155, in handle_error
raise IOError(‘wkhtmltopdf reported an error:\n’ + stderr)
OSError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: ContentOperationNotPermittedError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 114, in application
response = frappe.api.handle(request)
File “apps/frappe/frappe/api/init.py”, line 49, in handle
data = endpoint(**arguments)
File “apps/frappe/frappe/api/v1.py”, line 36, in handle_rpc_call
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 49, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1775, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/utils/typing_validations.py”, line 31, in wrapper
return func(*args, **kwargs)
File “apps/frappe/frappe/utils/print_format.py”, line 234, in download_pdf
pdf_file = frappe.get_print(
File “apps/frappe/frappe/init.py”, line 2191, in get_print
return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
File “apps/frappe/frappe/utils/pdf.py”, line 100, in get_pdf
frappe.throw(_(“PDF generation failed because of broken image links”))
File “apps/frappe/frappe/init.py”, line 652, in throw
msgprint(
File “apps/frappe/frappe/init.py”, line 617, in msgprint
_raise_exception()
File “apps/frappe/frappe/init.py”, line 568, in _raise_exception
raise exc
frappe.exceptions.ValidationError: PDF generation failed because of broken image links
what to do
Follow these steps simply,
Step 1: Download the correct version of wkhtmltopdf you need from the below link(Right click and copy download link address too),
https://wkhtmltopdf.org/downloads.html
Example: https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb. (copy Download link address)
Step 2: Open Downloads in Terminal
Step3: Enter following commands as in the example,
sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
. (copy the end of link address from wkhtmltopdf till .deb and paste)
sudo apt -f install