godex 1.0.0 copy "godex: ^1.0.0" to clipboard
godex: ^1.0.0 copied to clipboard

A dart package for communicating with and controlling Godex label printers.

example/godex_example.dart

import 'package:godex/godex.dart';

void main() {
  final stopwatch = Stopwatch()..start();
  Future.wait([printSticker()]);
  print('printSticker() executed in ${stopwatch.elapsed}');
}

const String godexIP = "172.30.2.154";
const String imageFile = "example/sticker.png";
const widthMm = 100;
const heightMm = 200;
const gapMm = 3;

Future<bool> printSticker() async {
  bool ret = false;
  final gdx = GodexIP(godexIP);
  final image = await Image.open(imageFile, heightMm: heightMm, dpi: 300);
  if (image != null) {
    if (await gdx.open()) {
      await gdx.setup(PrintingMode.directThermal, PaperType.labelWithGap,
          heightMm.toInt(), widthMm.toInt(), gapMm.toInt(),
          blackness: 14);
      await gdx.beginLabel();
      await gdx.drawImage(image);
      ret = await gdx.endLabel();
      await gdx.close();
    }
  }
  return ret;
}
1
likes
130
points
14
downloads

Publisher

verified publisherdevmel.com

Weekly Downloads

A dart package for communicating with and controlling Godex label printers.

Homepage
Repository (GitHub)
View/report issues

Topics

#godex #sticker #print

Documentation

Documentation
API reference

License

GPL-3.0 (license)

Dependencies

image, meta

More

Packages that depend on godex