zsdk 2.0.0+11
zsdk: ^2.0.0+11 copied to clipboard

A Flutter plugin for Zebra Link OS SDK

zsdk #

This is a flutter plugin for the Link-OS Multiplatform SDK for Zebra

Features #

  • Print ZPL from String
  • Print ZPL from file
  • Print PDF from file (only Android)
  • Printer calibration
  • Get printer settings
  • Set printer settings
  • Reset printer settings to default
  • Check printer status
  • Print configuration label

Currently this plugin only supports TCP/IP connection to the Printer.

IMPORTANT NOTES FOR iOS #

  • Make sure the zsdk plugin is added as a static library
  • Make sure to comment use_frameworks! in your Podfile project:
target 'Runner' do
#  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

How to use #

Add dependency #

# Add this line to your flutter project dependencies
zsdk: ^2.0.0+11

and run flutter pub get to download the library sources to your pub-cache.

Initialize a ZSDK object #

final zsdk = ZSDK();

Start the printer calibration #

zsdk.doManualCalibrationOverTCPIP(
  address: '10.0.0.100', 
  port: 9100 //optional
)

Get printer settings #

zsdk.getPrinterSettingsOverTCPIP(
  address: '10.0.0.100', 
  port: 9100 //optional
).then(value) {
 final printerSettings = PrinterResponse.fromMap(value).settings;
};

Set printer settings #

zsdk.setPrinterSettingsOverTCPIP(
  address: '10.0.0.100', 
  port: 9100, //optional
  settings: PrinterSettings(
    darkness: 10,
    printSpeed: 6,
    tearOff: 0,
    mediaType: MediaType.MARK,
    printMethod: PrintMethod.DIRECT_THERMAL,
    printWidth: 568,
    labelLength: 1202,
    labelLengthMax: 39,
    zplMode: ZPLMode.ZPL_II,
    powerUpAction: PowerUpAction.NO_MOTION,
    headCloseAction: HeadCloseAction.NO_MOTION,
    labelTop: 0,
    leftPosition: 0,
    printMode: PrintMode.TEAR_OFF,
    reprintMode: ReprintMode.OFF,
  )
).then(value) {
  final printerResponse = PrinterResponse.fromMap(value);
  if(printerResponse.errorCode == ErrorCode.SUCCESS) {
    //Do something
  } else {
    Status status = printerResponse.statusInfo.status;
    Cause cause = printerResponse.statusInfo.cause;
    //Do something
  }
}

Reset printer settings #

zsdk.setPrinterSettingsOverTCPIP(
  address: '10.0.0.100', 
  port: 9100, //optional
  settings: PrinterSettings.defaultSettings()
).then(value) {
   final printerResponse = PrinterResponse.fromMap(value);
   if(printerResponse.errorCode == ErrorCode.SUCCESS) {
     //Do something
   } else {
     Status status = printerResponse.statusInfo.status;
     Cause cause = printerResponse.statusInfo.cause;
     //Do something
   }
 }

Check printer status #

zsdk.checkPrinterStatusOverTCPIP(
  address: '10.0.0.100', 
  port: 9100, //optional
).then(value) {
   final printerResponse = PrinterResponse.fromMap(value);
   Status status = printerResponse.statusInfo.status;
   print(status);
   if(printerResponse.errorCode == ErrorCode.SUCCESS) {
     //Do something 
   } else {
     Cause cause = printerResponse.statusInfo.cause;
     print(cause);
   }
 }
zsdk.printZplFileOverTCPIP(
  filePath: '/path/to/file.pdf',
  address: '10.0.0.100', 
  port: 9100, //optional
).then(value) {
   final printerResponse = PrinterResponse.fromMap(value);
   Status status = printerResponse.statusInfo.status;
   print(status);
   if(printerResponse.errorCode == ErrorCode.SUCCESS) {
     //Do something 
   } else {
     Cause cause = printerResponse.statusInfo.cause;
     print(cause);
   }
 }
zsdk.printZplDataOverTCPIP(
  data: '^XA^FO17,16^GB379,371,8^FS^FT65,255^A0N,135,134^FDTEST^FS^XZ',
  address: '10.0.0.100', 
  port: 9100, //optional
).then(value) {
   final printerResponse = PrinterResponse.fromMap(value);
   Status status = printerResponse.statusInfo.status;
   print(status);
   if(printerResponse.errorCode == ErrorCode.SUCCESS) {
     //Do something 
   } else {
     Cause cause = printerResponse.statusInfo.cause;
     print(cause);
   }
 }
zsdk.printPdfFileOverTCPIP(
  filePath: '/path/to/file.pdf',
  address: '10.0.0.100', 
  port: 9100, //optional
).then(value) {
   final printerResponse = PrinterResponse.fromMap(value);
   Status status = printerResponse.statusInfo.status;
   print(status);
   if(printerResponse.errorCode == ErrorCode.SUCCESS) {
     //Do something 
   } else {
     Cause cause = printerResponse.statusInfo.cause;
     print(cause);
   }
 }

Check the example code for more details

12
likes
100
pub points
66%
popularity

Publisher

Unknown

A Flutter plugin for Zebra Link OS SDK

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

flutter

More

Packages that depend on zsdk