rusel1989 / react-native-bluetooth-serial

Port of https://github.com/don/BluetoothSerial for react native
476 stars 291 forks source link

How I Print text in bold #73

Open mtahir08 opened 6 years ago

mtahir08 commented 6 years ago

I want to print some values in bold. Can anyone knows how I can do this. Thanks

VyankeshH commented 6 years ago

@mtahir08 did you got a solution for this

mtahir08 commented 6 years ago

@VyankeshH I did it using escpos-xml package. https://www.npmjs.com/package/escpos-xml

But now I am facing issue in auto cut paper.

VyankeshH commented 6 years ago

undefined is not a function(evaluating '_escposXml.EscPos.getBufferXML(xml)') I got this type of error when I am trying with this library.Do you have any solution for this??

VyankeshH commented 6 years ago

@mtahir08 did you got qrcode using this.

https://www.npmjs.com/package/escpos-xml

mtahir08 commented 6 years ago
import { EscPos } from 'escpos-xml';
 const xml = `
    <?xml version="1.0" encoding="UTF-8"?>
    <document>
        <line-feed />
        <align mode="center">
            <bold>
                <text-line size="1:0">{{name}}</text-line>
            </bold>
            <line-feed />
            <small>
                <text-line size="1:0">---------------------</text-line>
                <text-line size="1:0">Dine-Inn</text-line>
                <text-line size="1:0">---------------------</text-line>
            </small>
            <line-feed />
            <text-line>Date & Time: {{moment date format="DD/MM/YYYY HH:MM"}} </text-line>
        </align>
          <line-feed />
    </document>
  `      
    const data = {
       name : 'Tahir' ,
      date:new Date()
    }

    const buffer_data = EscPos.getBufferFromTemplate(xml, data);

@VyankeshH Here is sample code. No I yet not use qrcode.

VyankeshH commented 6 years ago

@mtahir08 I got the result,But I didn't got table with this,Did you have any reference for this. Thank you