Posts tagged ‘Android’

Beispiel Kunden-Programmierung: Honeywell BasicTE

Ein Honeywell Kunde möchte von CK3, Windows Mobile 6, Intermec Terminal Emulation zu Honeywell CK65, Android 9, Honeywell BasicTE wechseln.

Für die SAP Telnet/VT Anwendung werden zwei spezielle Anpassung notwendig:

  1. Beim  Drücken der F5 Taste soll die Zeichenfolge “~[35” (F21) zum Host gesendet werden
  2. Wenn GS1-128 Barcode Typen gescannt werden, sollen diese mit dem Präfix [C1 versehen werden.
  3. Das GS Symbol in GS1-128 Barcode Typen muß durch “#” ersetz werden.

Die oben genannten Bedingungen sind auf dem CK3 implementiert. Dort kann man zB den Symbology Identifier (Aim ID) nur für GS1-128 einsetzen lassen. Auf dem CK65 ist diese Aim ID Einfügung nur global für alle Barcode Typen einschaltbar. Die Ersetzung des GS Symbols (hex: 0x1D) ist auf dem CK3 ebenfalls von Haus aus möglich. Der CK65 bietet dies Möglichkeit im Zusammenhand mit Honeywell BasicTE nicht.

Die Tastenbelgung F5->”~[35″ ist in der BasicTE Anwendung über die Anpassung der CustomKeyboard.xml möglich, welche auch das Tastenlayout und die Funktionen der BasicTE Software Tastatur bestimmt.

Da die BasicTE den Barcode Scanner direkt ansteuert muß die Aim ID Einsetzung und die GS Symbol ersetzung über ein sogenanntes DataEdit Plugin realisiert werden. Dazu ist etwas Android Programmierung notwendig. Diese Android Programm erhält dann die Barcode Daten und den Typ über einen Broadcast und kann die Daten dann verändert zurückliefern.

Nach erstenTests und Korrekturen kann der Kunde nun das CK65 uneingeschränkt statt dem CK3 verwenden.

Android: Print PDF to Thermal Portable Wireless Printer

Recently I got the request to write an application that prints a PDF file on a portable Thermal printer.

Normally that does not make sense, as the protable printers come with 2, 3, 4 or 5 inch paper width only. But the PDF files are created for 3 inch paper and os this Receipt printing makes sense.

The idea was to render the PDF to a bitmap and then print the bitmap to the printer. These printers do not support PDF or Postscript, they come with special Printer Language support as called ZPL, ESP/P, CPCL or others. So we need to create a Bitmap of the PDF first and then print the Bitmap.

I started using the Android Google PDFRenderer but this fails with two issues: the bitmaps created are always transparent and print with black background where white has to be; the text was not rendered as the Fonts did not render.

Among others I found PDFbox and after fixing a small issue with scaling of bitmaps the solution works very well.

The CPCL_Sample code and application can load a PDF file. This is then converted to a scaled bitmap which can then be printed to a CPCL compatible printer. The CPCL performance is very different and printing on a Zebra takes about a minute for a 3 by 4 inch sized bitmap.

The code has to use a lot of intents and background tasks as most processing takes some time. The bitmap is created by an IntentService. The Sewoo SDK prints the bitmap first to a queue buffer and there is no control or feedback about the status of the print job. So it hopefully prints after some time.

By replacing the print SDK you should be able to print the bitmap of the rendered PDF to any Bitmap-Printing capable printer.

Be warned: there are Printers that are compatible with a Printer Language like CPCL but may not support Bitmap printing.

Source code and apk at github.

Android development: btPrint4 prints demos and files to Bluetooth receipt and label printers

This is an update to my btPrint4 android application. The app now supports ‘printing’ of files. You are no longer tied to the provided demo files. ‘Printing’ here means it sends the file as is to the printer. So, watch your step and do not send files that your printer does not understand.

btprin4_file_main  btprint4_file_selected  btprint4_file_browse

Added a file browser activity: a class named item to hold file informations, a FileChooser class and a FileArrayAdapter. Then the needed layout files are added.

Continue reading ‘Android development: btPrint4 prints demos and files to Bluetooth receipt and label printers’ »

android: ipPrint4 print label/receipts to ip printer

ipPrint4

An android label/receipt printing app for TCP/IP connected printers

This app is based on my btPrint4 app. In contrast to btPrint4 this time we print on TCP/IP connected printers to port 9100.

As with btPrint4 we have a main activity and one to list available printers and one to list available demo files.

ipprint4_main pb31

The challenge with ipPrint4 was a replacement for the bluetooth device discovery. This time we have to scan TCP/IP address range for port 9100. This port is also called HP direct printing port and supported by many printers. It behaves similar to telnet and you can just send print commands to the interface.

The second main change to btPrint4 was the printing code. This time we do not have to use a bluetooth socket but a network TCP/IP socket.

A TCP/IP portscanner

If you scan a range of IP addresses in sequence and try to open a port with a timeout of, let’s say 200ms, the scan will take (200msx254, scan from 1 to 254) 50 seconds.

Port scan code Continue reading ‘android: ipPrint4 print label/receipts to ip printer’ »