Android Question Pos Print printing image via bluetoth print

scsjc

Well-Known Member
Licensed User
Longtime User
Hello, i need print image to bluetooth printer, i found this code in vb, some one can helpme?
thanks.


Function PicLine2(xLoc As Long, yLoc As Long) As Byte
Dim k As Byte
Dim j As Long
k = 0
For j = 1 To 8
DoEvents
'Debug.Print Picture1.Point(xLoc, j + yLoc) & " " & RGB(255, 255, 255)
If Picture1.Point(xLoc, j + yLoc) < RGB(84, 84, 84) Then
k = k + Power(9 - j, 2)
End If
Next
PicLine2 = k
End Function

Private Sub Delay(i As Long)
Dim k As Long
For k = 1 To i * 100
DoEvents
Next

End Sub

Private Sub Form_Load()
Dim k As Long
Dim d As Long

Me.Show
Picture1.Picture =Loadpicture ({filename})
frmMain.MSComm1.Output = Chr(27) & Chr(51) & Chr(25) ' set short line spacing
For d = 1 To 255 Step 8
frmMain.MSComm1.Output = Chr(27) & Chr(42) & Chr(0) & Chr(255) & Chr(0) ' Set graphic dump
For k = 1 To 255
DoEvents
frmMain.MSComm1.Output = Chr(PicLine2(k, d))
Delay (1) ' if we send too fast the printer dies
Next
frmMain.MSComm1.Output = vbCrLf ' chr(10)(13)
Next
frmMain.MSComm1.Output = Chr(27) & Chr(50) ' set default line spacing
Unload Me
End Sub


Function Power(X, Pow) As Long
Dim k As Long
Power = 1
For k = 2 To X
Power = Power * Pow
Next
End Function
 
Last edited:
Top