Ponnusamy1-V / frappe-pdf

Render PDF from server using google-chrome
MIT License
7 stars 7 forks source link

Issue exporting PDF in Chrome Headless #1

Open yamenzk opened 5 months ago

yamenzk commented 5 months ago

I have installed the app on my bench & site and enabled the setting to export using chrome however I get the following error;

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, 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 1682, 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 134, in download_pdf
    pdf_file = frappe.get_print(
               ^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 2091, in get_print
    return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe_pdf/frappe_pdf/__init__.py", line 10, in pdf
    return get_pdf_gc(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe_pdf/frappe_pdf/utils/pdf.py", line 75, in get_pdf
    subprocess.run(chrome_command, shell=False)
  File "/usr/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'google-chrome'

Running V15 on Frappe Cloud.

Thank you, a really important app.

Ponnusamy1-V commented 5 months ago

It requires Google Chrome to be installed

yamenzk commented 5 months ago

Google chrome is my default browser

Ponnusamy1-V commented 5 months ago

google-chrome should be installed in the server

yamenzk commented 5 months ago

Is that possible via Frappe Cloud?

Ponnusamy1-V commented 5 months ago

for now i think, this will not work in frappecloud. I have to test it in frappe cloud

MinHyeong-Lee commented 3 months ago

Any update for this?

My frappe server is running on AWS, and there is some issue for install google-chrome inside docker image..

yamenzk commented 3 months ago

I made this fork, it works on Frappe Cloud, https://github.com/yamenzk/frappe-pdf