1.0.0 • Published 11 months ago

ionic-zebra-label-printer v1.0.0

Weekly downloads
3
License
MIT
Repository
-
Last release
11 months ago

Plugin information

This plugin will enable your Ionic Cordova project to print using a Zebra printer. It's written to use TCP sockets for the native Android and iOS. In a browser version it will use a post request. If you are planning to use it in a web version served from HTTPS be warned, the Zebra printer only allows http calls. This causes Mixed Content issues if your not able to update the browser flag on the devices that will be used this will be a mayor issue.

Usage

You need to import the plugin in the file in which you want to call your print actions:

import { Plugins } from '@capacitor/core';

import 'ionic-zebra-label-printer';
const { ZebraLabelPrinter } = Plugins;

Initialise the printer object by passing the ip of the printer, port on which it is accessible (default for zebra is 9100) and code you want to print. \ Use the print object within the call to start printing.

let PrintObj = {
			ip: "xxx.xxx.xxx.xxx",
			port: xxxx,
			zpl: "your zpl formatted string"
		};

await ZebraLabelPrinter.print(PrintObj)
		.then(
			(res)=>{
			},
			(err)=>{
			}
		).finally(()=>{
		});

Android

This version is tested on physical devises (zebra scanner to printer and android phone to printer)

This requires some manual steps to use this plugin on android

Within the main activity you need to import the plugin and add it within the init function

    import nl.appcomm.zebraLabelPrinter.ZebraLabelPrinter; // <-- add this line

   	// Initializes the Bridge
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      // Additional plugins you've installed go here
      // Ex: add(TotallyAwesomePlugin.class);
      add(ZebraLabelPrinter.class); // <-- add this line
    }});

iOS

The iOS version is written with the use of the SwiftSocket pod. After building your project it could complain about;

  • the deployment target
  • the swift version

Both are easily solvable

Deployment target

While having xcode open press on the Pods.xcodeproj > SwiftSocket (whithin the Targets section) > General (tab) > Deployment Info Here you select the target needed.

Swift version

While having xcode open press on the Pods.xcodeproj > SwiftSocket (whithin the Targets section) > Build Settings (tab) > Swift Language Version Here you select the needed version

Web

The web version of this plugin uses an alternative method. It uses the post request option provided by zebra. Howver in order to uses this option you will need to enable a browser flag. This approach differs for each browser. In order to alter the flag you will need to search for "allow mixed content"

1.0.0

11 months ago

0.0.25

11 months ago

0.0.24

4 years ago

0.0.22

4 years ago

0.0.23

4 years ago

0.0.20

4 years ago

0.0.21

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.17

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.9

4 years ago

0.0.16

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

5 years ago