Android Tutorial BlueTooth Printing via SPP

timwil

Active Member
Licensed User
Longtime User
The following should give you double wide AND double high printing

PrintBuffer = Chr(14) & Chr(28) & "This Is A DoubleWide & High Line"
 

timwil

Active Member
Licensed User
Longtime User
I don't think you can have bold plus double height plus double width
 

microbox

Active Member
Licensed User
Longtime User
I don't think you can have bold plus double height plus double width
I'm looking for a text to print big fonts like the following format below..

In the manual, I'm trying to use DrawText() (but not sure )command..but I'm having no luck. Do you think the format I'm requiring can be done?
 

timwil

Active Member
Licensed User
Longtime User
No idea

I only use the double wide and double high

I have not done any graphics
 

Dman

Active Member
Licensed User
Longtime User
This works very well. Thank you for sharing. I have a question though.

I have been studying this very hard and am finally starting to get how it works. I see to center justify you are using
B4X:
 PrinterBuffer = PrinterBuffer & Chr(27) & "a" & Chr(1)

From the list of ESC/POS commands I see that center justify is
B4X:
 PrinterBuffer = PrinterBuffer & Chr(27) & Chr(97) & Chr(1)

They both work when testing. My question is why do you use the "a" instead of Chr(97)? It might be a dumb question but where did the "a" come from?
 

timwil

Active Member
Licensed User
Longtime User
I guess?

It works for me as is so I don't devote any further time to it - but you are free to expand on it

This was built from code fragments that I found here in the forum so you can go ahead and evolve it further.....
 

kris A

Member
Licensed User
Longtime User
i am having a bit of a problem with printing to datec dpp 350. I can connect to printer, assigned strings to printbuffer. It says that it printed but nothing comes out of the printer. I know the printer works because I can send to printer using the datec app. Can anyone help?
 

kris A

Member
Licensed User
Longtime User
This is a bluetooth connection. The program detects the printer fine. It even detects when it is not connected. It just doesnt print
 

timwil

Active Member
Licensed User
Longtime User
Then it might be what you are sending to the printer. Do you have a list of the printer commands? A command reference?

If the printer is in STAR emulation mode but you send ESC/POS commands to it - it will be confused and not know what to do so it probably would not print. Can you confirm what commands your printer requires?
 

timwil

Active Member
Licensed User
Longtime User
I see that your printer has a page mode and line mode. Normally the printer would be in line mode and would print on getting a CRLF. In page mode you build the whole page before it prints anything.

Try sending ESC . [ESC = chr(27) plus a dot chr(46)] to the printer - this according to the printer manual should print a self test. If that prints we know that your application is communicating with the printer properly.
 

kris A

Member
Licensed User
Longtime User
I tried printing Chr(27) & Chr(46). It said printed but nothing comes out of the printer.

If Success Then
PrintBuffer = Chr(27) & Chr(46)
'Msgbox(printer.IsInitialized,"printer")
printer.Initialize(cmp20.OutputStream)
printer.Write(PrintBuffer)
printer.WriteLine(PrintBuffer)
printer.Flush
Msgbox("Printed!" & PrintBuffer ,"")
printer.Close
cmp20.Disconnect
 

timwil

Active Member
Licensed User
Longtime User
on page three of the manual you sent is the way to get into hex dump mode

Holding LF button while power on
for ~ 2.5 sec and releasing it after the 2-beep.
It starts Hex DUMP mode.
All input data are printed hexadecimal
and as text.

Put the printer into Hex Dump mode then send a long line of text to be printed followed by a FF - form feed chr(12). If the printer is getting it then it will print the data in hex mode. That would confirm that the printer is getting the data and can print.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…