B4J Library jSD: Bluetooth Printer

Discussion in 'B4J Libraries & Classes' started by Star-Dust, Feb 28, 2019.

  1. Star-Dust

    Star-Dust Expert Licensed User

    BT_Printer library allows you to print text and image to a bluetooth thermal printers
    It is similar to the BT_Printer library for Android (BLE_Printer for iOS), and implementations, events and methods are almost identical.
    We are working to have the same library for all platforms. On iOS it will be different because it uses BLE, but we will try to standardize the use.

    This version requires an activation code. If you do not have a code then it will work in DEMO mode and you will only be able to print every 4 minutes.

    Dependence: jBluetooth

    jSD_BT_Printer

    Author: Star-Dust
    Version: 0.03
    • BT_Printer
      • Events:
        • BluetoothIsDisabled
        • ConnectedToPrint (Success As Boolean)
        • DiscoveryFinished
        • DiscoveryNewPrinter (Name As String, MacAdress As String)
        • DiscoveryNoDeviceFound
        • ErrorDiscovery
        • SendingError (Mac As String)
      • Fields:
        • AStream As AsyncStreams
      • Functions:
        • AddBuffer_ArrayByte (B As Byte()) As String
        • AddBuffer_BarCode (Code As String) As String
        • AddBuffer_Bitmap (Bmp As Image, ShiftLeft As Int) As String
        • AddBuffer_List_Write (list As List) As String
        • AddBuffer_List_WriteLine (list As List) As String
        • AddBuffer_Tab (ArrayTab As Int()) As String
        • AddBuffer_Write (Text As String) As String
        • AddBuffer_WriteLine (Text As String) As String
        • Class_Globals As String
        • ClearBuffer As String
        • Close As String
        • Connected As Boolean
        • flushAllAndClose As String
        • Initialize (CallBack As Object, EventName As String, EncodingType As String, CodeActivation As String) As String
          Initializes the object. You can add parameters to this method if needed.
        • IsInitialized As Boolean
          Verifica se l'oggetto sia stato inizializzato.
        • SearchNewPrinter As String
        • SelectFromMac (Mac As String) As String
        • SendBufferToPrinter ' Only with CodeActivation
    • ESC_POS
      • Fields:
        • BoldOff As String
        • BoldOn As String
        • DoubleOff As String
        • DoubleOn As String
        • FontA_Bold As String
        • FontA_DoubleHight As String
        • FontA_DoubleWide As String
        • FontA_DoubleWideHight As String
        • FontA_Normal As String
        • FontB_Bold As String
        • FontB_DoubleHight As String
        • FontB_DoubleWide As String
        • FontB_DoubleWideHight As String
        • FontB_Normal As String
        • InitializePrinter As String
      • Functions:
        • Process_Globals As String
    • Encoding
      • Fields:
        • ISO8859 As String
        • UTF8 As String
        • Windows1252 As String
      • Functions:
        • Process_Globals As String
    Stampa.png upload_2019-3-12_14-44-41.png
     

    Attached Files:

    Last edited: Mar 12, 2019
    DonManfred, Erel, Tayfur and 4 others like this.
  2. Star-Dust

    Star-Dust Expert Licensed User

    Update rel 0.02

    • Now you can print images.

    To get the activation code (to have the complete functions) contact me in private
     
    Johan Schoeman and inakigarm like this.
  3. vivekgarware

    vivekgarware Member Licensed User

    Is this the update of your library what i m trying for?
    Can i use it for b4a?
    If so, as you said how contact you privately?
    Private message means private conversation in b4a community site or your email? Pl provide email if necessary to contact u on email.
     
  4. Star-Dust

    Star-Dust Expert Licensed User

    This section of the forum is dedicated to B4J
     
  5. Star-Dust

    Star-Dust Expert Licensed User

    Update rel 0.03

    Code:
    Printer.AddBuffer_Writeline("TEST PRINTER")
    Printer.AddBuffer_Writeline(
    "_____________")
    Printer.SendBufferToPrinter
    Printer.ClearBuffer
    Printer.AddBuffer_Bitmap(CreateImage(
    Chr(0xF209),xui.CreateFontAwesome(60)),0)
    Printer.AddBuffer_Bitmap(CreateImage(
    Chr(0xF17B),xui.CreateFontAwesome(60)),0)
    Printer.SendBufferToPrinter

    Code:
    Sub CreateImage(Text As String,Font As B4XFont) As Image
        
    Dim Can As B4XCanvas
        
    Dim V As B4XView = xui.CreatePanel("")
        V.SetLayoutAnimated(
    0,0,0,120,120)
     
        Can.Initialize(V)
        Can.DrawRect(Can.TargetRect,xui.Color_White,
    True,1)
        Can.DrawText(Text,Can.TargetRect.CenterX,Can.TargetRect.CenterY,
    Font,xui.Color_Black,"CENTER")
        Can.Invalidate
        
    Return Can.CreateBitmap
    End Sub
    RESULT
    OtherFont.png
     
    Johan Hormaza, inakigarm and Erel like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice