directprint 1.0.3 copy "directprint: ^1.0.3" to clipboard
directprint: ^1.0.3 copied to clipboard

PlatformWindows

Directprint The plugin allows Flutter applications to send raw text and control codes to POS printer on Windows platfom

directprint #

Directprint The plugin allows Flutter applications to raw print to Windows printers using the OpenPrinter/StartDocPrinter system functions, mainly for sending raw text and control codes to POS printers.

The plugin is intended for the Windows platform.

Getting Started #

The Directprint() class allows you to send codes directly to a Windows printer with the help of the "print" method.

    Future<String?> print(String printer, String job, Uint8List data)

Call the "print" method with arguments:

String printer - Sistem printer name 
String job - Specifying job name in print queue
Uint8List data - raw data bytes

The result of the call is a Future String with the following content:

"OK" - if the call ended without error
"ERROR:1" - Error: Opening Printer
"ERROR:2" - Error: Opening Document
"ERROR:3" - Error: Starting Page
"ERROR:4" - Error: Printing Count```

Installing #

  1. Add this package to your package's pubspec.yaml file as described on the installation tab

  2. Import the librarie

   import 'package:directprint/directprint.dart';

Example code #

    import 'package:directprint/directprint.dart';
    
    Future doPrint() async {
       // ...
       final _directprintPlugin = Directprint();
   
       // ...
       String data = "Direct print plugin test ...\n\n\n\n";
       Uint8List enctxt = Uint8List.fromList(data.codeUnits);
       
       String printer = 'POS-58';
       String job = 'Invoice';
       
       String dpResult =
         await _directprintPlugin.print(printer, job, enctxt) ?? '';
   
       // ...
    }
2
likes
160
pub points
80%
popularity

Publisher

verified publisherfraktal.hr

Directprint The plugin allows Flutter applications to send raw text and control codes to POS printer on Windows platfom

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on directprint