Android Question BT_Printer

rogel a. tolentino

Member
Licensed User
  • AddBuffer_ArrayByte (B As Byte()) As String
  • AddBuffer_BarCode (Code As String) As String
  • AddBuffer_Bitmap (Bmp As Bitmap, ShiftLeft As Int) As String
  • AddBuffer_BitmapAlternativeCoding (Bmp As Bitmap) 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
  • AddPrintDefineImage As String
It is very useful to me using SD_BT_Printer.jar in applying different font. My problem is how to print Bmp and barcode. Your sample1 I download has an error when accessing addBuffer_Bitmap.

What is the correct code in printing bitmap ang barcode. attached is sample1.zip from you which I tried and have error


CenterJustify As String
 

Attachments

  • Sample1.zip
    10.2 KB · Views: 21

Star-Dust

Expert
Licensed User
Hi Roger,

You should indicate the error you are experiencing (copied in test format). It is also useful to know which printer you are testing it with, not all printers have the same method of printing images.

Finally, are you using the DEMO version?
 
Upvote 0

rogel a. tolentino

Member
Licensed User
The error is at addbuffer_bitmap
Sub RadioButtonMIX_CheckedChange(Checked As Boolean)
Printer.ClearBuffer
Printer.AddBuffer_Writeline("TEST - Mixed Text and Image")
Printer.AddBuffer_Writeline("012345678901234567890123456789-F")
'Printer.AddBuffer_Bitmap(LoadBitmap(File.DirAssets,"qr.jpg"),0)
Printer.AddBuffer_Bitmap(LoadBitmap(File.DirRootExternal ,"Logo.bmp"),0)
Printer.AddBuffer_Writeline("END PRINT")

Preview.Panel.Height=Printer.Preview.Height
Preview.Panel.SetBackgroundImage(Printer.Preview)
End Sub

Yes the demo version. How can I get a real one?
 
Upvote 0

Star-Dust

Expert
Licensed User
I would like to know which error it generates not which code. An error in the logs? is the error in the print?
 
Upvote 0

rogel a. tolentino

Member
Licensed User
1654167515786.png
1654167640985.png
 
Upvote 0

Star-Dust

Expert
Licensed User
The above screen shot shown error
Hi Roger,

You should indicate the error you are experiencing (copied in test format). It is also useful to know which printer you are testing it with, not all printers have the same method of printing images.

Finally, are you using the DEMO version?
As I wrote you I needed the errors in text format not in image format. The first time you sent me a piece of code and the second time two images.
I don't know if it's my fault that I don't write English well, but it could be the other way around.

Anyway, the error I see is that it is looking for a file named Logo.bmp. In my example there is no file with this name nor in the code that you have attached in a ZIP file. So you would like us to find an error on a different source than the one you gave us. It seems like an impossible operation.

I would suggest a few things: First check why look for this image. Second I saw that you create the image from code, but it doesn't reflect the correct dimensions. The image I put in my code is 330pixel wide. this is the maximum he has to achieve. Third thing, always use the latest version of b4A.

Finally there is an error that is not clear to me. It seems that you are looking for a method (LogImpl) which is not part of my library, I suppose something you added yourself.

From the pictures I can only understand that. You didn't tell me what printer you use ..... maybe if you give me the information I ask (in text format) you could understand more
 
Upvote 0

virpalacios

Member
Licensed User
Longtime User
Hi, I got some problems in printing images (bitmap logo and qrcode). In some printers it worked fine but in other printers I got a extrage behavior (garbage printing). SD indicates it was a buffer issue, so I divided my printing and for each section I cleared buffer.

Best Regards
 
Upvote 0

rogel a. tolentino

Member
Licensed User
I'm glad to inform you that when I installed a new version of B4a your sample program run smoothly.
but when i change this
Printer.AddBuffer_Bitmap(LoadBitmap(File.DirAssets,"qr.jpg"),0)
to
Printer.AddBuffer_Bitmap(LoadBitmap(File.DirRootExternal ,"Logo.bmp"),0)
error at my android phone with message "Bluetooth Printer Sample has stoped " considering that Logo.bmp exist at said location
even I add this
rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)


You have mentioned that this is a demo version. I am interested to a real one and willing to donate? How much should I donate?
Please help me on how to print image and barcode. Thanks
 
Upvote 0

Star-Dust

Expert
Licensed User
the image is located on DirRootExternal, if you have recent versions of Android the runtime permissions are not sufficient to access this part of memory.
 
Upvote 0
Top