Chrome PDF Generator issues (Print_designer)

I understand, that since print designer V1.5.0 we have the option to use chrome for pdf generation instead of wkhtmltopdf.
We run V1.5.2, is there anything we need to change in order to use chrome, or is this now enabled by default?

@maharshivpatel Any hint to documentation is appreciated.

used custom print format is uses wkhtmltopdf

PDF generation using Chrome was added due to the technical limitations of wkhtmltopdf.

Personally, I recommend using Chrome for PDF generation.

You can change here:

Thanks for all the replies, unfortunately I don’t see the option using chrome as PDF generator.

Our Server ist running:

Installed Apps

ERPNext: v16.0.0-dev

Framework: v16.0.0-dev

Print Designer: v1.5.2

is there anything else we need to do in order to activate the chrome option?

Try bench setup-chrome
And bench migrate

hmm, seems thats not it

I’m not saying this is the only problem, but you do have a version mismatch between Frappe, ERPNext, and Print Designer. If you are using develop branch for the first two, then Print Designer’s develop branch should be used as well. Hopefully that’s all it is.

Changed to dev branch, unfortunately still the same problem.

ReportLab has a pdfgen module since long time, used in big projects.

thanks for bringing this up, I think this information is more relevant to the developer in case they wanna integrate it into frappe. In my case fixing the issue would probably be better

this comment its relevant today?

1 Like

If you mean the docker dependencies mentioned in the article, yes. You need to make sure those packages are part of your build as you create an image with the print_designer app.

Errored out saying no such command ‘setup-chrome’
I am using bench 5.25.9

That means you don’t have the print_designer app in your bench. If you’re on docker, you need it part of your image build. If not on docker, you need to bench get-app. Then, regardless of your environment, you need to install it to your site.

‘PDF Generator’ option can solve the problems.

For ‘wkhtmltopdf‘, it is required:

Ensure the required version, if you can not then use ‘chrome‘ as the PDF generator.

Thanks!

Even though I have changed from wkhtmltopdf to Chrome in print settings, still using wkhtmltopdf to generate pdf and causing issues.

Hi @sivarocky

Framework → Printing → select format → change PDF generator

The format level will override the default settings level

Hope it helps

Hi, I have tried as you have guided. Now the print format uses Chrome generator, but causing some other issues. I have linked the error code. Kindly give me a solution. Thank you for your response.

Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 121, in application
response = frappe.api.handle(request)
File “apps/frappe/frappe/api/_init_.py”, line 63, in handle
data = endpoint(**arguments)
File “apps/frappe/frappe/api/v1.py”, line 41, in handle_rpc_call
return frappe.handler.handle()
~~~~~~~~~~~~~~~~~~~~~^^
File “apps/frappe/frappe/handler.py”, line 53, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 86, in execute_cmd
return frappe.call(method, **frappe.form_dict)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/_init_.py”, line 1147, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/utils/typing_validations.py”, line 36, in wrapper
return func(*args, **kwargs)
File “apps/frappe/frappe/utils/print_format.py”, line 245, in download_pdf
pdf_file = frappe.get_print(
doctype,
…<6 lines>…
pdf_generator=pdf_generator,
)
File “apps/frappe/frappe/utils/print_utils.py”, line 86, in get_print
pdf = frappe.call(
hook,
…<4 lines>…
pdf_generator=local.form_dict.pdf_generator,
)
File “apps/frappe/frappe/_init_.py”, line 1147, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/utils/pdf.py”, line 159, in wrapper
result = func(*args, **kwargs)
File “apps/frappe/frappe/utils/pdf.py”, line 181, in get_chrome_pdf
browser = Browser(generator, print_format, html, options)
File “apps/frappe/frappe/utils/pdf_generator/browser.py”, line 23, in _init_
self.open(generator)
~~~~~~~~~^^^^^^^^^^^
File “apps/frappe/frappe/utils/pdf_generator/browser.py”, line 76, in open
generator._set_devtools_url()
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File “apps/frappe/frappe/utils/pdf_generator/chrome_pdf_generator.py”, line 228, in _set_devtools_url
raise TimeoutError(“Chromium took too long to start.”)
TimeoutError: Chromium took too long to start.

@sivarocky - have you installed using docker?