i do not know java,and never use eclipse before, i study make libary 1 week,now have self library now )
i have test this code many times, it is really hardly work for me,
here cannot upload my eclipse project,it is too big,how to upload it ?
if this library can help you ,i will send my eclips project .my java is poor,
if i upload eclips project ,you can make this libary more better then me.
i have test on my pos printer,work good now ,can print picture.string
my print device use default ".connectusb" fuction, if you change print device need ".connectusb2" instead.
and you need get your usb" VendorID , productID"
how to get your print device ID ,here have picture .(do not forget add 0x before your IDs)
the ".printdata"fuction ,you can send HEX code to printer. it is is printer control code.in PDF file have EPSON FAQ, in FAQ,the Turn "white/black reverse "command "1d 42", MUST change to under FORMAT SEND:
"0x1d, 0x42, 0x01". (0x01 must put in end. and add 0x)
In mainfest need add usb permition :
under is b4a sample code
i have test this code many times, it is really hardly work for me,
here cannot upload my eclipse project,it is too big,how to upload it ?
if this library can help you ,i will send my eclips project .my java is poor,
if i upload eclips project ,you can make this libary more better then me.
i have test on my pos printer,work good now ,can print picture.string
my print device use default ".connectusb" fuction, if you change print device need ".connectusb2" instead.
and you need get your usb" VendorID , productID"
how to get your print device ID ,here have picture .(do not forget add 0x before your IDs)
the ".printdata"fuction ,you can send HEX code to printer. it is is printer control code.in PDF file have EPSON FAQ, in FAQ,the Turn "white/black reverse "command "1d 42", MUST change to under FORMAT SEND:
"0x1d, 0x42, 0x01". (0x01 must put in end. and add 0x)
In mainfest need add usb permition :
B4X:
AddActivityText(main,
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
)
under is b4a sample code
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#BridgeLogger: True
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
Dim pt As printdemo
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
pt.initialize
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
Dim vid As Int
Dim pid As Int
vid=0x1CBE
pid=0x0003
pt.connectusb2(vid,pid) 'HERE IS YOU DEVICE VendorID AND productID"
End Sub
Sub Button2_Click
pt.printstr("UNDER IS PICTURE")
pt.printtest 'TEST PAPER
End Sub
Sub Button3_Click
Dim pic As Bitmap
pic.Initialize(File.DirAssets,"look.bmp")
pt.printstr("UNDER IS PICTURE")
pt.Print_BMP2(pt.POSPrintBMP(pic,300,0)) '(PICTURE,PAPER WIDTH,0)
Sleep(1000)
pt.cut 'CUT PAPAR
pt.Printbeep 'VOICE BEEP
End Sub
Attachments
Last edited: