zebra printer

0
I need to use Zebra printer (Thermal printer) while using Mendix and it does not work . The report paper that need to be printed , look like a bill papar. any advice or suggestion would be nice
asked
6 answers
1

Do you run your mendix app in a browser or in a native app created by phone gap?

How do you try to connect to the zebra printer? Do you want to connect by an app module of Mendix app Store? 

Please, provide more information.

answered
0

Are you sure this is a Mendix related question?

answered
0

any advice would be nice

answered
0

Did you read this: https://developer.zebra.com/community/home/blog/2018/04/13/printing-from-websites-part-1 ?

answered
0

Hi Pasit,

Looks like you can print through javascript. The browser print section of this documentation shows some example code and more details.

https://www.zebra.com/content/dam/zebra/software/en/application-notes/zebra-web-printing-solutions-app-notes.pdf

 

To run custom javascript in Mendix, you could use a custom widget or build your own widget.

 

I think the examples use a specific javascript library, and in order to that you will have to create a custom widget.

Here is some documentation on custom widgets

https://docs.mendix.com/howto50/creating-a-basic-hello-world-custom-widget

https://docs.mendix.com/howto/custom-widget-development/

 

 

Here are two widgets that are used often to run custom javascript in a mendix app. You can also give these a try.

https://appstore.home.mendix.com/link/app/56/

https://appstore.home.mendix.com/link/app/43096/

 

Hope this helps!

 

 

 

answered
0

Hi, 

I found a solution for WEB Responsive Printing with Zebra BrowserPrint SDK (Working for me with Zebra GC420 USB Printer but it works with bluetooth and ethernet printers too)

1 – Download and install Zebra Browser Print, It automatically identify usb printers connected to your pc, you must only select the default printer.

https://www.zebra.com/us/en/products/software/barcode-printers/link-os/browser-print.html

2 – In mendix project, Edit \..\theme\index.html, Add a Javascript function in the javascript section.

<script type="text/javascript">
            var selected_device;
            var devices = [];
            function setup()
            {
                //Get the default device from the application as a first step. Discovery takes longer to complete.
                BrowserPrint.getDefaultDevice("printer", function(device)
                        {
                    
                            //Add device to list of devices and to html select element
                            selected_device = device;
                            devices.push(device);
                                                        
                                            
                        }, function(error){
                            //alert(error);
                        })
            }
            function writeToSelectedPrinter(dataToWrite)
            {
                selected_device.send(dataToWrite, undefined, errorCallback);
            }
            var errorCallback = function(errorMessage){
                alert("Error: " + errorMessage);    
            }
            window.onload = setup;
        </script>

3 – Call the Javascript function using a Javascript Action, like this:

 

import { Big } from "big.js";

 

// BEGIN EXTRA CODE

// END EXTRA CODE

 

/**

* Ação javascript para imprimir através do web responsivo utilizando o driver Zebra BrowserPrint.

* @param {string} zpl

* @returns {Promise.<Big>}

*/

export async function Act_Imprimir_ZebraBrowserPrint(zpl) {

    // BEGIN USER CODE

    writeToSelectedPrinter(zpl)

    // END USER CODE

}

Hope it works fot you too!

answered