B4i Library iSD BLE Printer

I am happy to present my library to print with Iphone (and iPad) with Bluetooh (BLE). Now I can print the images. If you want to have the activation code (Freeing all the functions) contact me in private.
(For B4J versione see Here, for B4A versione see Here, for ZEBRA printer Here)

This version requires an activation code. If you don't have a code, it will work in DEMO mode and you can print for just one minute every 4 minutes.


iSD_BLE_Printer

Author:
Star-Dust
Version: 0.25
  • BLE_Printer
    • Events:
      • Connected (services As List)
      • Disconnected
      • ImagePrintingCompleted
      • PrinterFound (Name As String, ID As String)
      • WriteComplete (Characteristic As String, Success As Boolean)
    • Fields:
      • CharatteristicName As NSString*
      • ServiceName As NSString*
    • Functions:
      • AddTab (ArrayTab As Int()) As NSString*
        Add Tab
        eg. PrinterBLE.AddTab(Array As Byte(100,150,121))
      • CenterJustify As NSString*
        after this command calls SendBufferToPrinter
      • Class_Globals As NSString*
      • Connect (ID As NSString*) As NSString*
      • Initialize (ba As B4I*, CallBack As NSObject*, EventName As NSString*, EncodingType As NSString*, CodeActivation As NSString*) As NSString*
        Initializes the object. You can add parameters to this method if needed.
      • InitializePrinter As NSString*
      • IsInitialized As BOOL
        Verifica se l'oggetto sia stato inizializzato.
      • LeftJustify As NSString*
        after this command calls SendBufferToPrinter
      • PrintBitmap (bmp As B4IBitmap*)
      • RightJustify As NSString*
        after this command calls SendBufferToPrinter
      • ScanPrinter As NSString*
      • SetCodePage (Code As Unsigned char) As NSString*
        es. Printer.SetCodePage(06) for umlauts char
      • Write (Text As NSString*) As NSString*
        Write (Print) a Text
      • Write_ArrayByte (B As Unsigned char()) As NSString*
        Write (Send to Printer) a Array of Byte
        eg. PrinterBLE.Write_ArrayByte(Array As Byte(0x1D,150,23))
        eg. PrinterBLE.Write_ArrayByte("Text".GetBytes("UTF8"))
      • WriteBarCode (Code As NSString*) As NSString*
      • WriteLine (Text As NSString*) As NSString*
        Write (Print) a Text + CHLF
      • WriteList (list As B4IList*) As NSString*
        Write (Print) a List
    • Properties:
      • CodeTable
        es. printer.setCodeTable(Ecoding.Code_WPC1252)
        aftet this command calls SendBufferToPrinter
      • isConnect As BOOL [read only]
      • Spacing
        after setSpacing command calls SendBufferToPrinter
  • ESC_POS
    • Fields:
      • BoldOff As NSString*
      • BoldOn As NSString*
      • DoubleOff As NSString*
      • DoubleOn As NSString*
      • FontA_Bold As NSString*
      • FontA_DoubleHight As NSString*
      • FontA_DoubleWide As NSString*
      • FontA_DoubleWideHeight As NSString*
      • FontA_Normal As NSString*
      • FontB_Bold As NSString*
      • FontB_DoubleHeight As NSString*
      • FontB_DoubleWide As NSString*
      • FontB_DoubleWideHeight As NSString*
      • FontB_Normal As NSString*
      • Horizzontal As NSString*
      • InitializePrinter As NSString*
      • NoUnderline As NSString*
      • QueryErrorCauses As NSString*
      • QueryOfflineCauses As NSString*
      • QueryPaperStatus As NSString*
      • QueryPrinterStatus As NSString*
      • Underline1 As NSString*
      • Underline2 As NSString*
      • Vertical As NSString*
    • Functions:
      • Process_Globals As NSString*
        Code module
        Subs in this code module will be accessible from all modules.
  • Encoding
    • Fields:
      • Chinese As NSString*
      • ChineseS As NSString*
      • Code_PC437 As Int
      • Code_PC850 As Int
      • Code_PC857 As Int
      • Code_PC858 As Int
      • Code_PC860 As Int
      • Code_PC863 As Int
      • Code_WPC1252 As Int
      • DOS_Latin_1 As NSString*
      • IBM_PC As NSString*
      • ISO8859 As NSString*
      • UTF8 As NSString*
      • Windows1252 As NSString*
    • Functions:
      • Process_Globals As NSString*
        Code module
        Subs in this code module will be accessible from all modules.
 

Attachments

  • iSD_BLE_Printer 0.25.zip
    256.9 KB · Views: 26
  • SampleBLE_Printer.zip
    111.6 KB · Views: 19
Last edited:

Maicon

Member
Licensed User
Longtime User
There is a conflict with the lib SD BLE Printer and iHttpUtils2, every return of request in HttpJob closes the application, giving the error unrecognized selector sent to instance 0x281675e80.

Is there any solution for this? I'm attaching a small project
 

Attachments

  • ios_sdPrinter.zip
    5.7 KB · Views: 3
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Hi Maicon,

There is no conflict between the iSD_BlePrinter library and iHttpUtils2. You probably need to rethink your way of diagnosing problems.

I am attaching the example you gave me, removing the library and its BlePrinter classes, leaving only your code to download the file ... The download does not work even without the BlePrinter library.
There is a programming error. The specific URL you requested cannot be read with Job.GetString. For more tips on how to do this you can ask the question in the forum
 

Attachments

  • teste sd printer2.zip
    5.4 KB · Views: 1
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Hi StarDust, I have an airpad, model 1. It has iOS 12
Will I be able to print QR with this library?
And a bitmap?
I did not see how to buy it, point me please in that direction

Many Thanks
The only sure answer is to try the library. In the first posts you will find the libraries and examples.

I printed the bitmaps and qr. But you need to try it with the printer you will use it on, there may be compatibility issues.

After you are sure that everything is working and that this library has the methods you are looking for then I will explain how to make the donation
 

Pablo Torres

Active Member
Licensed User
Longtime User
The only sure answer is to try the library. In the first posts you will find the libraries and examples.

I printed the bitmaps and qr. But you need to try it with the printer you will use it on, there may be compatibility issues.

After you are sure that everything is working and that this library has the methods you are looking for then I will explain how to make the donation
Great. I will try it and let you know what happens.
Many thanks
 

Pablo Torres

Active Member
Licensed User
Longtime User
The only sure answer is to try the library. In the first posts you will find the libraries and examples.

I printed the bitmaps and qr. But you need to try it with the printer you will use it on, there may be compatibility issues.

After you are sure that everything is working and that this library has the methods you are looking for then I will explain how to make the donation
Unfortunately, not working on my devices (iPhone 11 Pro Max and iPad Air 2, both of them have iOS 15.6.1)
This is what it shows the logs:

Copying updated assets files (2)
Application_Start
Application_Active
Library demo version
SignalHandler 6
Error occurred on line: 48 (Main)
Signal - 6
Stack Trace: (
"0 BLE Printer SignalHandler + 120",
"1 libsystem_platform.dylib 0x00000001dc968d48 D2B9EA44-3EDF-39C4-8E5C-BB3AD9CC58DD + 11592",
"2 libsystem_kernel.dylib 0x00000001bc34cbe0 14ABFFC1-C15E-3C93-A655-A917279DB06C + 187360",
"3 libsystem_kernel.dylib 0x00000001bc34cc10 14ABFFC1-C15E-3C93-A655-A917279DB06C + 187408",
"4 TCC B40C0C40-D80C-3BE6-BC47-CFCF0CBEFA82 + 30472",
"5 TCC B40C0C40-D80C-3BE6-BC47-CFCF0CBEFA82 + 9168",
"6 TCC B40C0C40-D80C-3BE6-BC47-CFCF0CBEFA82 + 20116",
"7 libxpc.dylib 5E25C660-3EAA-3D72-890C-E68CA120FCC2 + 103252",
"8 libxpc.dylib 5E25C660-3EAA-3D72-890C-E68CA120FCC2 + 54972",
"9 libdispatch.dylib 4FC02901-034E-35CF-8CF2-5B7F81D579E4 + 409868"
)


I'm attaching the project, is the same of the sample but I added one button for printing barcode (that is not the problem denitely)

Can you give me a hand on this?

Many thanks
 

Attachments

  • SampleBLE_Printer.zip
    111.6 KB · Views: 2

Star-Dust

Expert
Licensed User
Longtime User
Hi,

There are several programming errors. It is not true that you have only added a button, but it has inserted a timer that initializes the printer every 3 seconds, this is meaningless, it is useless and continuously blocks the printer.

The QR button is never displayed because you have not entered the view in the connection event.

Finally, as regards the crash for the SignalHamdler 6, as often recommended you should first look on the forum because often others have already found a solution. With a short search I found this:
 

Pablo Torres

Active Member
Licensed User
Longtime User
Hi,

There are several programming errors. It is not true that you have only added a button, but it has inserted a timer that initializes the printer every 3 seconds, this is meaningless, it is useless and continuously blocks the printer.

The QR button is never displayed because you have not entered the view in the connection event.

Finally, as regards the crash for the SignalHamdler 6, as often recommended you should first look on the forum because often others have already found a solution. With a short search I found this:
You're right. Everything is working
I'm ready for the full version, just send you a PM, please check it

Many Thanks
 
Top