Mail: [email protected] Phone: +1(424)231-4091

Creating Custom Print Handler

A printing handler is a service or a script used to manage printing. By default, NexoPOS comes with a default print handler which is the browser printing. However sometime, you might want to print differently an order. That technique was used by Nexo Print Adapter which inject on NexoPOS a new custom print handler.

This guide will share how to create your own print handler.


Before creating a print handler, you need to be familiar with creating modules on NexoPOS. We really do not recommend you touch the source code. You should also know how to inject views on the footer.

Add A New Option As A Printing Gateway

The first step is to register our customer print gateway. This will be made by adding on your ServiceProvider.php the following snippet.

This will inject the new option into the Printing settings.

Catching Print On The POS Screen

Now that we've created a new handler, we need to catch every print request submitted from the POS screen. We then need to inject a view on the footer of the POS. This can be made using the hook "ns-dashboard-pos-footer" and then by loading a view within the module Resources/Views directory.

Now, we'll edit that file to catch custom print requests. This will be made using the javascript filter "ns-order-custom-print".

Now, every time we're printing with that custom print gateway selected, that log should appear on the console.

Next Step: Custom Implementation

The reason of providing a custom print handler is to be able to print as you desire. As you can see, you get the order id that you can use to perform an async request to retrieve either the default printing template:

How the default template is retrieved by NexoPOS

But you can also make custom calls to your modules API to retrieve the order details. Remember while loading users you can pull: customers, products, refund, payments, etc like this.

From there, you can basically do everything you want.