Network Printer / Print Server in ERPNext

I stumbled on the “Network Printer / Print Server” functionality in ERPNext accidentally. This uses CUPS, which is an Apple open-source project (IPP) that comes installed with every Mac. So, I assumed, that after setting up a Network Printer, I could “natively” print on a printer without the PDF preview and printer selection that torments users of web apps.

I tried setting this up on frappe.cloud but the setup requirements were not met on the bench. After contacting frappe.cloud support, I got the following response by support:

Pycups will now be installed on all benches on Frappe Cloud. We’ve updated your existing benches, so no action is needed from your end.

Frappe.cloud support is awesome!

After opening port 631 on our firewall, I was able to discover my network printer and I saved it.

But now comes the question: how do I actually print on my Network Printer from within ERPNext / Frappe? I was assuming that there is a “Network Print” button or something of that sort in the print formats.

Anyone used this before who can shed some light, and so we can improve the docs here?

Thanks,
Dom

PS: exposing your CUPS print server on port 631 for the whole world is not a good idea. Currently, there is no way to password-authenticate, so you would have to set up your firewall to only let through a request from your frappe server. You can also do this on Frappe cloud by finding out what IP address is behind your domain name example.frappe.cloud (however any site running on that server at Frappe could then access your printers).

3 Likes

I have been looking for this for a long time. My attempts were not successful.

Hi, any update on this? There is still no Network Print button or something of that sort? What was the solution you used @dominik?

I was looking for this too. I don’t think this is possible through the UI.
Printing to a network printer/print server seems to be possible via API though. Through the API endpoint /api/method/frappe.utils.print_format.print_by_server.
Three parameters are needed: doctype, name and printer_setting (which is the name given to your network server when adding it to ERPNext).

Hi,

@daanl I’m rying to get Network Printing working, where did you find the API info and requirements/syntax? I’ve been searching it and not been able to find it.

Thanks,
Paul

Hi @pmjd,

I found this by combing through the source code.
If you would like to learn more about this, you can find the implementation here.

Does this help?

Kind regards,
Daan

1 Like

You can add a custom button in the UI using Client Script and call the relevant API.

Thank you, hopefully gets me a step closer

Can you tell me how I can call the API via a Client Script, I’m looking through the docs but can’t find how to set this up. Attempts so far generate lots of errors when the DocType loads.

See here: Add a Custom Button

You can add a custom button which can perform a function. You can make it call the API using frappe.call()

1 Like

Thank you