アンドロイドデバイスからTSP100スタープリンタに印刷する領収書を作成しようとしています。私はどこでも検索しており、ラスタライズされた領収書を印刷する簡単な例は見つけられません(TSP100はラスタを受け入れるだけなので)。私はStarに電子メールを送り、次のコードを送ってきましたが、これが正しいかどうか、これを受け取り、フォーマットされたビットマップに変換して印刷する方法がわかりません。アンドロイドのStar TSP100プリンタでラスタレシートを作成する
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 ..今
プリンタにビットマップにArrayListのリストから取得します。簡単な領収書の例は不思議に役立ちます。私はSTARからリクエストしてきましたが、どれくらい時間がかかりますか?私は誰かがこれをしているに違いないと思います。
ありがとうございます。
こんにちはケールエヴァンス、私はODP 160-GがUSB経由のモバイル印刷をサポートしていることを知りたがっていますか? –
こんにちはケール、私はアンドロイドがUSB経由でプリンターのStar TSP100 ecoを検出したために何ができるのだろうと思っています。マニュアルに従って試しましたが、プリンターを検出できません。火をつける)http://www.starmicronics.com/Printer/PrinterDesc.aspx?PageId=1&PrinterId=110 – cesarggf
こんにちはKale Evansさん。ロゴと改造者の名前を一列に印刷していますか? –