Issues with Printing Invoices and Print Designer on Frappe/ERPNext Version 15

Hi everyone,

I’m encountering several issues related to printing invoices on Frappe/ERPNext Version 15. Specifically, I’m having trouble with the following:

  • Printing invoices and generating PDFs
  • Setting up Print Formats
  • The new Print Designer app

When using the default print format for Sales Orders (“Sales Order PD v2”), it’s throwing errors and failing to generate a proper output. However, when I remove this format, I’m able to view and print the PDF, but the resulting format is messy and unsuitable for my prospective clients.

The Print Designer app also has several bugs related to formatting. I’m unable to achieve the desired print output, and I can’t delete elements from the canvas. Additionally, PDF generation isn’t functioning as expected.

Here are the versions of the installed apps:

  • Frappe CRM: v2.0.0-dev
  • Ecommerce Integrations: v1.17.0
  • ERPNext: v15.36.0
  • Frappe Framework: v15.41.0
  • Frappe HR: v15.29.0
  • Frappe Insights: v3.0.0
  • Payments: v0.0.1
  • Print Designer: v1.2.0 AND v1.4.2

Has anyone else encountered similar issues or found a solution? Any advice or guidance would be greatly appreciated!

Thanks in advance.

Hi,

Is this Frappe cloud or self hosted? If self hosted, pdf problems are sometimes due to wkhtml2pdf. Check that wkhtmltopdf (version 0.12.5 with patched qt) is installed.

It is self-hosted with wkhtmltopdf 0.12.6.1 (with patched qt). I can view and print the ugly PDF format when removing the “Sales Order PD v2” from the print format input field. I installed the Print Designer App and it is full of bugs/issues. I am looking to create a custom sales order PDF template for my first client and my company too.

hi @edardev
i had a case like yours in an invoice in a custom app and as you mentioned the print_designer can’t be used it’s not ready yet, I had to create a custom print format using jinja and CSS unfortunately the bootstrap didn’t work in print format frappe v15-x-develop, also i had to set my doctype as a custom to set a default print format for it.

Yes, I agree we are on the same page. I deployed another instance with the following versions, without the Print Designer App, and it seems to be working without the issues mentioned earlier. However, I now need to find a way to customize the Print Format somehow using jinja and CSS unfortunately.

Installed Apps:

  • Frappe Builder: v1.0.0-dev
  • Frappe CRM: v2.0.0-dev
  • ERPNext: v15.34.1
  • Frappe Framework: v15.40.3
  • Frappe HR: v15.28.3
  • Frappe Insights: v3.0.0
  • Payments: v0.0.1"

it’s not a big deal as it sounds but it takes time :clock1: depend on how the invoice is

@edardev i think there is misunderstanding default format is set as sales order pd v2 which is broken ( which will be fixed on next release).

you can just create format using print_designer and make it default.

even if print_designer is installed you can just set any format as default and it will not try to load sales order pd v2 format.

please share individual issue and i can help you solve them.

Thank you for sharing the issues

1 Like

would love to know more about what are the issues you faced.

1 Like

I agree that the default format for Sales Order is broken “Sales Order PD v2” in the latest release, and might be unrelated to the Print Designer app.

When trying to create a format using the Print Designer app, it’s not working either. Additionally, I cannot delete elements from the canvas while designing the format. I’ve reported the issue on GitHub, and I’d be happy to share more details about the problems I encountered. :muscle:

deleting element is fixed in develop branch. can you please check it

1 Like

Was it fixed today? I tried using the ‘develop’ branch yesterday, but it didn’t work. I also created a new custom Docker image today with the ‘main’ branch, but that didn’t work either. If it was fixed today, I’ll create another Docker image to test it. Thanks in advance!

yes it was fixed today. i need someone to check it fix works or not because it’s always worked on my setup

1 Like

Thank you!, I am going to build a new image right now and try it :rocket:

Good News First:
Yes! The delete functionality in the Print Designer App is now working as expected :raised_hands:.

Bad News Second:
However, creating a new print format with the Print Designer App is still causing issues. It’s throwing errors, and I’m unable to preview or print the file, just like what happened with the “Sales Order PD v2” on the latest versions of Frappe/ERPNext.

Installed Apps

Frappe CRM: v2.0.0-dev
Ecommerce Integrations: v1.17.0
ERPNext: v15.36.1
Frappe Framework: v15.41.0
Frappe HR: v15.29.0
Frappe Insights: v3.0.0
Payments: v0.0.1
Print Designer: v1.2.0

Why do the latest versions of ERPNext and the Print Designer app work seamlessly on Frappe Cloud for printing invoices, receipts, and custom print formats, while I encounter broken functionalities when using various versions of Frappe, ERPNext, and Print Designer including the latest and same version using different installation methods? What might I be missing?

image

I’m eager to contribute to the Frappe ecosystem and help improve user experience and integrations. In the meantime, I’ve found a temporary workaround to print custom invoices using the Print Designer app, while awaiting future bug fixes.

Temporary Solution:

  1. Create a custom Print Format with the New Print Designer App.
  2. Select the dynamic data for a specific invoice and save it.
  3. A preview will be generated as a JPG image.
  4. Navigate to the File List, download the image, and then convert the JPG to a PDF.

This workaround can be used until the issues are addressed in upcoming releases.

I’ve installed two older versions of ERPNext as well as the latest version, and the issue with using a custom Print Format template only occurs when the Print Designer app is also installed. Additionally, when the Print Designer is installed, the default print format is set to “Sales Order PD v2,” which immediately triggers an error, even if you attempt to switch to another custom template and change the default print template too.

image

Without the Print Designer app, the document displays fine. However, I need a custom template for my customer, and during a demo, he specifically requested this feature. Unfortunately, the feature was broken, and the demo didn’t go as planned.

image

I tested the latest “main” branch, and the issue with deleting items has been resolved, similar to the “develop” branch. However, we’re still encountering issues when printing new sales orders, sales invoices, and other documents using the “Print Designer” app.

Identified Issues:

  1. Default Templates: It seems that default templates are not being generated, which prevents them from being located or used during the printing and preview process.




We switched back and forth between the “develop” and “main” branches but are still encountering printing issues, even after creating new print formats and setting them as the default. Occasionally, creating a new custom user permission for the preview JPG file resolves the issue temporarily, allowing us to print, but it suddenly stops working again without any clear reason.


Request for Assistance

I appreciate the creator’s ongoing efforts to address this issue, as I’ve noticed recent updates and GitHub commits. However, we are still experiencing challenges.

Could you kindly assist in further investigating these problems? Any guidance on ensuring that default templates are properly generated and resolving the recurring permission errors would be greatly appreciated.

Thank you for your time and support!

Hi everyone,

I wanted to follow up on the issues with printing invoices and the Print Designer in Frappe/ERPNext Version 15. It seems like several users are encountering similar challenges, especially when it comes to customizing print formats and generating PDFs correctly. Could we get an update on any potential fixes or workarounds for this issue? It would be helpful to know if there’s a timeline for a resolution or if there are specific logs or details that we could provide to assist with debugging. Thanks for your attention to this matter!

Traceback with variables (most recent call last):
  File "apps/frappe/frappe/core/doctype/file/utils.py", line 368, in attach_files_to_document
    file.insert(ignore_permissions=True)
      doc = <PDPrintFormat: Sales Order PD v2>
      event = 'on_update'
      attach_fields = [<Attach ImageDocField: print_designer_preview_img parent=Print Format>]
      df = <Attach ImageDocField: print_designer_preview_img parent=Print Format>
      value = '/private/files/print_designer-sales_order_pd_v2-preview3f12d3.jpg'
      unattached_file = None
      file = <File: unsaved>
  File "apps/frappe/frappe/model/document.py", line 285, in insert
    self.run_method("before_insert")
      self = <File: unsaved>
      ignore_permissions = True
      ignore_links = None
      ignore_if_duplicate = False
      ignore_mandatory = None
      set_name = None
      set_child_names = True
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
      self = <File: unsaved>
      method = 'before_insert'
      args = ()
      kwargs = {}
      fn = <function Document.run_method.<locals>.fn at 0x7fd10e041580>
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
      self = <File: unsaved>
      args = ()
      kwargs = {}
      hooks = []
      method = 'before_insert'
      doc_events = {'*': {'on_update': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.core.doctype.file.utils.attach_files_to_document', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply', 'frappe.automation.doctype.assignment_rule.assignment_rule.update_due_date', 'frappe.core.doctype.user_type.user_type.apply_permissions_for_non_standard_user_type'], 'after_rename': ['frappe.desk.notifications.clear_doctype_notifications'], 'on_cancel': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions', 'frappe.automation.doctype.assignment_rule.assignment_rule.apply'], 'on_trash': ['frappe.desk.notifications.clear_doctype_notifications', 'frappe.workflow.doctype.workflow_action.workflow_action.process_workflow_actions'], 'on_update_after_submit': ['frappe.workflow.doctype.workflow_action.workflow_action.process_w...
      composed = <function Document.hook.<locals>.compose.<locals>.runner at 0x7fd10e041080>
      compose = <function Document.hook.<locals>.compose at 0x7fd10e0416c0>
      f = <function Document.run_method.<locals>.fn at 0x7fd10e041580>
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
      self = <File: unsaved>
      method = 'before_insert'
      args = ()
      kwargs = {}
      add_to_return_value = <function Document.hook.<locals>.add_to_return_value at 0x7fd10e0413a0>
      fn = <function Document.run_method.<locals>.fn at 0x7fd10e041580>
      hooks = ()
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
      self = <File: unsaved>
      args = ()
      kwargs = {}
      method_object = <bound method File.before_insert of <File: unsaved>>
      method = 'before_insert'
  File "apps/frappe/frappe/core/doctype/file/file.py", line 104, in before_insert
    self.save_file(content=self.get_content())
      self = <File: unsaved>
  File "apps/frappe/frappe/core/doctype/file/file.py", line 539, in get_content
    with open(file_path, mode="rb") as f:
      self = <File: unsaved>
      file_path = './demo.menteware.com/private/files/print_designer-sales_order_pd_v2-preview3f12d3.jpg'
builtins.FileNotFoundError: [Errno 2] No such file or directory: './demo.menteware.com/private/files/print_designer-sales_order_pd_v2-preview3f12d3.jpg'