gpos720_printer 0.0.1 copy "gpos720_printer: ^0.0.1" to clipboard
gpos720_printer: ^0.0.1 copied to clipboard

retracted

A Flutter plugin to integrate printing in the Gertec GPOS720.

gpos720_printer #

A Flutter plugin to integrate printing in the Gertec GPOS720.

Features #

Methods Implemented
checarImpressora ✔️
fimImpressao ✔️
avancaLinha ✔️
imprimirTexto ✔️
imprimirImagem ✔️
imprimirCodigoDeBarra ✔️
imprimirTodasFuncoes ✔️
imprimirEscPos ❌️

Requirements #

  • Android minimum sdk version >= 22.
  • Flutter version >= 2.0.0.
  • Dart version >= 2.12.0.

Instalation #

Step 1 #

  • In the "/android/src/main/AndroidManifest.xml", add:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    <uses-feature android:name="android.hardware.usb.host" />
    ...
</manifest>

Step 2 #

The Android Gradle Plugin (AGP) doesn’t support direct local AAR dependencies in Android library projects due to how it packages the resulting AAR, so we need to do the following configurations.

  • In the "/android/app/libs/" directory, paste the two .aar dependencies used by this library. You can find them in this link.

  • Then in the "android/app/build.gradle", add:

...
Android{
    ...
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.aar'])
    }
}
...
  • Lastly in the "android/build.gradle", add:
...
allprojects {
    repositories {
        google()
        mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }
}
...

Getting Started #

Just instantiate the "Gpos720Printer" and invoke the desired functions as shown in this example project.

You must have a Gertec GPOS720 device to be able to use this plugin.

Instantiate: #

Instantiate the "Gpos720Printer" object like this:

import 'package:gpos720_printer/gpos720_printer.dart';
void main(){
  Gpos720Printer gpos720Printer = Gpos720Printer();
}

Documumentation #

Methods: #

Future<String?> avancaLinha(int quantLinhas)

  • Description: Adds line breaks to the current printout.
  • Return: A String indicating the printer status, which returns true if “isPrinterOK”.
  • Parameters:
  1. quantLinhas: An Integer specifying the desired number of line breaks.
  • Throws: An Exception if the printer fails.

Future<String?> checarImpressora()

  • Description: Checks the printer’s status.
  • Return: : A String indicating the printer’s status in Portuguese.
  • Throws: An Exception if the printer fails.

Future<String?> fimImpressao()

  • Description: Finalizes the printing queue.
  • Return: A String indicating the printer’s status in Portuguese".
  • Throws: An Exception if the printer fails.

Future<String?> imprimirCodigoDeBarra(String mensagem, int width, int height, BarcodeTypes barcodeType)

  • Description: Prints various types of barcodes.
  • Return: A String indicating the printer status, which returns true if “isPrinterOK”.
  • Parameters:
  1. mensagem: A String specifying the desired data on the barcode.
  2. width: An Integer specifing the desired width.
  3. height: An Integer specifing the desired height.
  4. barcodeTypes: A BarcodeTypes enum specifing the desired barcode type.
  • Throws: An Exception if the printer fails.

Future<String?> imprimirImagem(Uint8List data, int width, int height, {AlignmentTypes align = AlignmentTypes.center})

  • Description: Prints raw images.
  • Return: A String indicating the printer status, which returns true if “isPrinterOK”.
  • Parameters:
  1. data: A Uint8List with the image raw data.
  2. width: An Integer specifing the desired width.
  3. height: An Integer specifing the desired height.
  4. align (optional): An AlignmentTypes enum specifying the desired alignment. By default, align will be center.
  • Throws: An Exception if the printer fails.

imprimirTexto(String mensagem, {TextOptions? options, int size = defaultFontSize, Font? font, AlignmentTypes align = AlignmentTypes.left})

  • Description: Prints text.
  • Return: A String indicating the printer status, which returns true if “isPrinterOK”.
  • Parameters:
  1. mensagem: An String with the desired text to be printed.
  2. options (optional): A TextOptions specifing if the text will be render as bold, italic or underlined.
  3. size (optional): An Integer specifing the desired font size.
  4. Font (optional): A Font specifing the desired font to be used in the text.
  5. align (optional): An AlignmentTypes enum specifying the desired alignment. By default, align will be left.
  • Throws: An Exception if the printer fails.

Future<String?> imprimirTodasFuncoes(Uint8List data, int width, int height)

  • Description: Prints all printer functions.
  • Return: A String indicating the printer status, which returns true if “isPrinterOK”.
  • Parameters:
  1. data: A Uint8List with the image raw data.
  2. width: An Integer specifing the desired width.
  3. height: An Integer specifing the desired height.
  • Throws: An Exception if the printer fails.

Configutarion parameters: #

BarcodeTypes

An enum to indicate the type of barcode to be printed. Click here to consult the available types.

AlignmentTypes

An enum to indicate the type of barcode to be printed. Click here to consult the available types.

Font

An object to specify the desired font for printing. The constructor receives the font name as a parameter, and the font must be available in the assets folder under the directory "/fonts". By default, it is set to "NORMAL", click here to view the implementation.

TextOptions

An object that specifies the desired text decoration. It can add bold, italic, or underline styles. By default, all styles are set to false, click here to view the implementation.

TODO #

  • Pass image data from outside the MethodChannel to avoid payload size/speed limitations.
  • Implement plugin tests.
  • Standarize exceptions outputs.
  • Print raw ESC/POS commands.
5
likes
0
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to integrate printing in the Gertec GPOS720.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on gpos720_printer

Packages that implement gpos720_printer