Printing from Javascript

// Expert user has replied.
C Chris Harp 1 month ago
245 2 0

I'm looking for recommendations and best practices for enabling printing from a web applications. Specifically, we're looking at adding print capabilities to Microsoft Dynamics 365 Field Service, both from a desktop browser and a mobile device (via the Field Service app which can run Javascript). After digging around the various Zebra SDKs and such, I'm thinking the best option is Browser Print. Are there any other options that would be a better fit? 
Also, are there any recommended virtual printers to use for development? I found one on Github (Virtual ZPL Printer) that seems pretty nice, though it seems to be flakey when paired with Browser Printer. What do other developers do for testing while building customizations, short of having a physical device and printing lots of wasted labels?

Any help would be greatly appreciated. Thanks!

Printers: Zebra ZQ610 Plus Mobile Printer, Zebra Zd411 Desktop Label Printers
Devices: Zebra TC58A1

Please Register or Login to post a reply

2 Replies

S Steven Si

An alternative to the Browser Print is the SendFileToPrinter API, which is a cloud based REST API for label printing. It's probably the simplest way for integrating label printing feature in a web application. For development, a real Zebra printer is required. Without a real printer, it's almost impossible for label printing feature development. To save labels during development, we can set the printer in journal mode (continuous paper mode) and cover the label detection sensor with a dark tap. So that the printer can operate normally without paper.

 

C Chris Harp

I'm not sure if SendFileToPrinter will be a viable alternative for the customer I am working with. They are already using the Field Service app offline, so they may not have internet access to call that API.

If I'm understanding all of that correctly, SendFileToPrinter is just a single endpoint where I would pass in my API key, Tenant ID, Printer serial number, and the ZPL file? Since the intention is to deploy a fleet of these to multiple users/locations, the serial number will need to be dynamic. Would I use the Asset Ownership Service to get a list of printers? Is there any way to assign printers to specific people, or would they have access to all printers in the tenant?

Ultimately, we are looking to dynamically generate ZPL based on data in Field Service, launch a window to select which printer to send it to, how many copies to print, and display a preview of the label (currently using Labelary for this). I have this working in a proof of concept now with Browser Print, but they are getting pushback on needing to have another application installed. I'm concerned that a fully web-based integration won't be an option due to working offline.

CONTACT
Can’t find what you’re looking for?