打印从Android应用程序与蓝牙打印机蓝牙、应用程序、打印机、Android

2023-09-04 12:28:15 作者:稚爱

我正在开发Android版devices.In我的应用程序在Android计费应用程序,我不得不打印蓝牙打印收据中的具体格式为活动显示器,这是我showned below.i要打印整个屏幕,我下面showned。我想知道如何识别最近的蓝牙打印机?如何配置呢?以及如何在蓝牙打印机打印数据。该应用程序是兼容previous版本。我搜索很多,但没有得到任何正面回应。

I am developing an android billing application for Android devices.In my application i had to print the receipts in the Bluetooth printer in the specific format as the activity displays ,which i showned below.i have to print the whole screen as i showned below. i want to know how to recognize nearest Bluetooth printers?,How to configure them ?and also how to print data in a Bluetooth printer. the app is Compatible for previous version. I searched lot but not got any positive response.

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

推荐答案

这个程序将打印文本到蓝牙打印机。我使用的是Android设备和蓝牙打印机。您可以在此库轻松集成到您的项目打印支持蓝牙打印机。更多的例子点击此处

This app will print text to Bluetooth printer. I am using an android device and a Bluetooth printer. You can easily integrate this library to your project for printing support to Bluetooth printer. For More example Click Here

private void print_bt() {
    try {
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    btoutputstream = btsocket.getOutputStream();
    byte[] printformat = { 0x1B, 0x21, FONT_TYPE };
    btoutputstream.write(printformat);
    String msg = message.getText().toString();
    btoutputstream.write(msg.getBytes());
    btoutputstream.write(0x0D);
    btoutputstream.write(0x0D);
    btoutputstream.write(0x0D);
    btoutputstream.flush();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
 
精彩推荐
图片推荐