I'm trying to create a receipt that will print from an android device to a TSP100 Star printer. I have searched everywhere and can not find a simple example of printing a rasterized receipt (since TSP100 only accepts raster). I emailed Star and they sent me the following code, but I'm not sure this is correct, or how to take this and convert it to a formatted bitmap and print it.
byte[] data;
ArrayList<Byte> list = new ArrayList<Byte>();
Byte[] tempList;
list.addAll(Arrays.asList(new Byte[]{0x1b, 0x1d, 0x61, 0x01}));
data = "[If loaded.. Logo1 goes here]\r\n".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
list.addAll(Arrays.asList(new Byte[]{0x1b, 0x1c, 0x70, 0x01, 0x00, '\r', '\n'})); //Stored Logo Printing
data = "Company Name\r\n".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
data = "Street1\r\nCity, ST, ZIPCODE\r\n\r\n".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
list.addAll(Arrays.asList(new Byte[]{0x1b, 0x1d, 0x61, 0x00})); // Alignment
list.addAll(Arrays.asList(new Byte[]{0x1b, 0x44, 0x02, 0x10, 0x22, 0x00})); //Set horizontal tab
data = "Date: 2/22/2012".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
list.addAll(Arrays.asList(new Byte[]{' ', 0x09, ' '})); //Moving Horizontal Tab
data = "Time: 9:18 PM\r\n------------------------------------------------\r\n\r\n".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
list.addAll(Arrays.asList(new Byte[]{0x1b, 0x45})); // bold
data = "SALE \r\n".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
list.addAll(Arrays.asList(new Byte[]{0x1b, 0x46})); // bolf off
data = "SKU ".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
list.addAll(Arrays.asList(new Byte[]{0x09}));
// notice that we use a unicode representation because that is how Java expresses these bytes at double byte unicode
// This will TAB to the next horizontal position
data = " Description \u0009 Total\r\n".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
data = "34353434 \u0009 SP500\u0009 100.99\r\n".getBytes();
tempList = new Byte[data.length];
CopyArray(data, tempList);
list.addAll(Arrays.asList(tempList));
ETC..
Now to get from the ArrayList list to a bitmap to the printer. A simple receipt example would help wonders. I've requested it from STAR, but not sure how long they will take to get back. I figure someone out there must have done this.
Thank you.