januslo / react-native-bluetooth-escpos-printer

React-Native plugin for the bluetooth ESC/POS & TSC printers.
MIT License
368 stars 430 forks source link

Remove white space after print image ? #236

Open aasuparekh1 opened 11 months ago

aasuparekh1 commented 11 months ago

I need to remove white space after print image between image and text ??!!!

This is my code:

<Button disabled={this.state.loading || this.state.boundAddress.length <= 0} title="Print FOLLOWING Image" onPress={async () => { const compnayname = '\x1B\x21\x10' + 'Tested Image' + '\x1B\x21\x00'; const textOptions = { widthtimes: 2, heighttimes: 2, fonttype: 1, }; const ticketNumber = 123456; const departureCity = 'City A'; const arrivalCity = 'City B'; const departureTime = '12:00 PM'; const seatNumber = 'B12'; const ticketPrice = '25.00'; const amounttype = 'Cash' const travelDate = new Date(); try { // await BluetoothEscposPrinter.printerLineSpace(0); // await BluetoothEscposPrinter.printPic(base64Jpg, { width: 220, left: 20 });

        // await BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.RIGHT);
        // await BluetoothEscposPrinter.printText(compnayname, textOptions);
        // await BluetoothEscposPrinter.printText("\r\n\r\n\r\n", {});

        await BluetoothEscposPrinter.printPic(base64Jpg, { width: 200, left: 40 })

        await BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER);
        await BluetoothEscposPrinter.printText(compnayname, textOptions);
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.LEFT);
        await BluetoothEscposPrinter.printText('Ticket No:' + ticketNumber, { widthtimes: 1, heigthtimes: 1, fonttype: 1 });
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printText('Departure:' + departureCity, { widthtimes: 1, heigthtimes: 1, fonttype: 1 });
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printText('Arrival:' + arrivalCity, { widthtimes: 1, heigthtimes: 1, fonttype: 1 });
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printText('Departure Time:' + departureTime, { widthtimes: 1, heigthtimes: 1, fonttype: 1 });
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printText('Date:' + travelDate.toLocaleDateString(), { widthtimes: 1, heigthtimes: 1, fonttype: 1 });
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printText('Seat No:' + seatNumber, { widthtimes: 1, heigthtimes: 1, fonttype: 1 });
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printText('Amount:' + ticketPrice + '/-', { widthtimes: 1, heigthtimes: 1, fonttype: 1 });
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printText('Amount Type:' + "" + amounttype, { widthtimes: 1, heigthtimes: 1, fonttype: 1 });
        await BluetoothEscposPrinter.printText('\r\n', {});

        await BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER);
        await BluetoothEscposPrinter.printQRCode(`${ticketNumber}`, 280, BluetoothEscposPrinter.ERROR_CORRECTION.L);

        await BluetoothEscposPrinter.printText('\r\n\r\n\r\n', {});
    } catch (e) {
        alert(e.message || "ERROR")
    }
}}

Please check attach image in this image i need to remove white space help to solve it. 1703243047962