LogoLogo
v7.0.0
v7.0.0
  • TotalCross Overview
  • TotalCross Javadoc
  • TotalCross Changelog
  • Roadmap
  • Documentation
    • Getting Started
      • First embedded project with TotalCross
    • Components
      • Accordion
      • Aligned Labels
      • Button
      • Check
      • ComboBox
      • Dynamic Scroll
      • Edit
      • Floating Button
      • Gpiod
      • Grid
      • GridContainer
      • Image
      • ImageControl
      • ImageList
      • Label
      • Material Icons
      • Material Window
      • MessageBox
      • Multi Edit
      • Progress Bar
      • Progress Box
      • Radio
      • Radio Group
      • Scroll Container
      • Side Menu
      • Slider
      • Sliding Window
      • Spin List
      • Spinner
      • Switch
      • Tabbed Container
      • Velocimeter
    • APIs
      • API Overview
      • API Rest
      • Asynchronous Task
      • Camera
      • Control
        • Main Window
        • Window
        • Container
      • GPS
      • HTTPS and SSL
      • JSON
      • Maps
        • Maps - Deprecated
        • Static Map
      • Material Design Standards
      • Ninepath
      • Notifications
      • PrinterManager
      • Push Notification Firebase
      • Scanner
      • SOAP
      • Socket
      • SocketServer
      • SQLite Encryption
      • QR Code Generator
      • totalcross.sys
      • Youtube API
    • Creating an Issue
    • Contributing
      • Branch workflow
      • Writing documentation
    • Guides
      • App Architecture
        • Suggested Architecture
        • Why do Design Patterns help with the application's organization?
          • MVC Architecture Pattern
          • Template Pattern
          • Data Persistence: DAO Pattern.
        • Separation of concepts: What is the best way to create UI interfaces?
        • Positioning
          • Manual Positioning
        • Relative Positioning
        • Best practices to improve project maintenance
      • Device Simulator
      • Package your app from scratch
        • TotalCross SDK
        • Environment Variables in IDE
          • Eclipse
          • IntelliJ
        • Deploy your app with a dependecy TC
        • Deploy iOS
          • Using Development certificate to test your apps
      • Understanding TotalCross for Linux ARM
      • Running C++ applications with TotalCross
      • Web Services
    • Miscelaneous
      • Java JDK 8
      • Maven
      • Installing Visual Studio Code
    • FAQ
      • IMEI in Android 10
Powered by GitBook
On this page
  • Overview
  • Atributes
  • Methods
  • Usage

Was this helpful?

  1. Documentation
  2. APIs

PrinterManager

Overview

PrinterManager is the class responsible for enabling printing on Cielo machines and it uses the singleton pattern to guarantee a unique instance of PrinterManager.

Atributes

The attributes will be inserted into the hashMap and will be used at the time of printing

Used in alignment - KEY_ALIGN

Name

Description

VAL_ALIGN_CENTER

Align to center

VAL_ALIGN_LEFT

Align to left

VAL_ALIGN_RIGHT

Align to right

Other features

Name

Description

KEY_TEXT_SIZE

Text size, must be an integer value

KEY_TYPEFACE

Text font, must be an integer between 0 and 8, where each value is a different font

KEY_MARGIN_LEFT

Left margin, must be an integer value

KEY_MARGIN_RIGHT

Right margin, must be an integer value

KEY_MARGIN_TOP

Top margin, must be an integer value

KEY_MARGIN_BOTTOM

Bottom margin, must be an integer value

KEY_LINE_SPACE

Spacing between consecutive lines, must be an integer value

KEY_WEIGHT

Used when printing multiple columns, to choose the weight of each column, must be an integer value

Methods

Name

Description

getInstance()

Creates a new instance or returns the instance previously created.

printText(String textToPrint, Map<String, Integer> printerAttributes)

printText(String textToPrint, Map<String, Integer> printerAttributes, PrinterListener printerListener)

Prints the text received in the textToPrint parameter.

printerAttributes will have the attributes of the print.

printerListener will receive the PrinterListener interface methods

Usage

Code Example
HashMap<String, Integer> printerAttributes = new HashMap<>();

printerAttributes.put(PrinterAttributes.KEY_ALIGN, PrinterAttributes.VAL_ALIGN_CENTER);
printerAttributes.put(PrinterAttributes.KEY_TYPEFACE, 1);
printerAttributes.put(PrinterAttributes.KEY_TEXT_SIZE, 20);

String textToPrint = "TEXT TO PRINT";
PrinterManager.getInstance()
               .printText(textToPrint, printerAttributes);

PreviousNotificationsNextPush Notification Firebase

Last updated 6 years ago

Was this helpful?