Giter Site home page Giter Site logo

lulzzz / android-pos-print-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 614 KB

A point of sale (POS) printer API. Providing simple printing access to many popular receipt style printers

Home Page: https://github.com/Aevi-UK/android-pos-print-api/wiki

License: Apache License 2.0

Java 98.43% Shell 1.57%

android-pos-print-api's Introduction

Introduction

This API allows developers to quickly and easily integrate printing for receipt printers into your Android application. The API allows you to print using any AEVI enabled device and selected printer drivers. Specifically this API is designed for use with receipt/line printer type devices.

The print API itself makes extensive use of reactive (Rx) based principles. Therefore in the case of the Java API it makes heavy use of the RxJava library. To read more about Rx principles and the RxJava library itself see the documentation here. For the remainder of this documentation it is assumed that the reader is familiar with asynchronous and event-based programming using observable streams.

Prerequisites

This API is an entry point to the AEVI Printing Service. In order to use this API sucessfully on a device the printing service application must be installed along with printer driver applications that will handle the actual print process with the physical devices.

Binaries

In your main gradle.build you'll need to include our public bintray in your main repositories section.

repositories {
    maven {
        url "http://dl.bintray.com/aevi/aevi-uk"
    }
}

And then add to your dependencies section

compile 'com.aevi.print:print-api:1.1.0'

Sample usage

The main entry point to the SDK is to first obtain an instance of the PrintManager. This object can then be used to send print jobs, actions and listen to printer events.

To get an instance of the PrintManager within your application

      PrinterManager printerManager = PrinterApi.getPrinterManager(this);

In order to bind to the printer service your application must also request the permission com.aevi.permission.NGS_PRINT_SERVICE

<uses-permission android:name="com.aevi.permission.NGS_PRINT_SERVICE"/>

The PrinterManager can then be used as shown below to send a print job to a printer. If no printer is specified then the print will be sent to the default printer. You can specify a printer by setting the printerId in the PrintPayload object. PrinterIds are obtained via the PrinterManager using the getPrinterSettings() method.

if(printerManager.isPrinterServiceAvailable()) {

  PrintPayload payload = new PrintPayload();

  // fill out payload here. Described below

  printerManager.print(payload)
          .subscribe(new Consumer<PrintJob>() {
              @Override
              public void accept(@NonNull PrintJob printResult) throws Exception {
                  // Do something with results here
                  Log.d(TAG, "Got printing result:: " + printResult.getPrintJobState());
              }
          }, new Consumer<Throwable>() {
              @Override
              public void accept(@NonNull Throwable throwable) throws Exception {
                  Log.e(TAG, "Error while printing", throwable);
              }
          });
}

Full Documentation

Bugs and Feedback

For bugs, feature requests and discussion please use GitHub Issues

LICENSE

Copyright 2017 AEVI International GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

android-pos-print-api's People

Contributors

andreas-borglin avatar annalytics avatar brettwold avatar louis-barman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.