Lanlan Sun
Lanlan Sun

Reputation: 27

TSPL with Sunmi V2S

I am currently using a SUNMI printer to print tickets using TSPL commands. Everything is working well so far, but I am encountering an issue where there is a space at the top of the ticket. To resolve this, I need to implement a command that feeds the paper back to eliminate this gap.

I would greatly appreciate any assistance or guidance you can provide on how to achieve this.

Thank you very much in advance.

Here is my code

Sub print_tspl
 Dim Command As String

 Command = "SIZE 100 mm, 43 mm" & Chr(13) & Chr(10)
 Command = Command & "GAP 0 , 0 " & Chr(13) & Chr(10)
 Command = Command & "DIRECTION 0" & Chr(13) & Chr(10)
 Command = Command & "BACKFEED 50" & Chr(13) & Chr(10)
 Command = Command & "CLS" & Chr(13) & Chr(10)

 Command = Command &"TEXT 0,0,""1"",0,1,2,"""&Left(pub.csql(LabelDescrizioneProdotto.Text),32)&"""" & Chr(13) & Chr(10)'DESCRIZIONE
 Command = Command & "TEXT 1,1,""1"",0,1,2,"""&Left(pub.csql(LabelDescrizioneProdotto.Text),32)&"""" & Chr(13) & Chr(10)'DESCRIZIONE
 
 If LabelDescrizioneProdotto.Text.Length>32 Then
     Command = Command & "TEXT 0,39,""2"",0,1,2,"""&Left(pub.csql(LabelDescrizioneProdotto.Text.SubString(32)),32)&"""    " & Chr(13) & Chr(10)'DESCRIZIONE2
     Command = Command & "TEXT 1,40,""2"",0,1,2,"""&Left(pub.csql(LabelDescrizioneProdotto.Text.SubString(32)),32)&"""   " & Chr(13) & Chr(10)'DESCRIZIONE2
 End If
 
 If LabelPrezzoOfferta.Visible=True Then
     Dim percentuale As Double=pub.xss(((LabelPrezzoVenditaText.Text-LabelPrezzoOfferta.Text)/LabelPrezzoVenditaText.Text)*100,2)
     
     Command = Command & "TEXT 0,85,""3"",0,2,2,"""&LabelPrezzoVenditaText.Text.Replace(".",",")&"""" & Chr(13) & Chr(10)'PREZZO ORIGINALE
     Command = Command & "TEXT 0,77,""3"",0,2,2,""———""" & Chr(13) & Chr(10)
     Command = Command & "TEXT 0,140,""3"",0,2,2,""-"&percentuale&"%""" & Chr(13) & Chr(10)'SCONTO IN PERCENTUALE
     Command = Command & "TEXT 190,80,""TSS32.BF2"",0,2,3,""€ "&LabelPrezzoOfferta.Text.Replace(".",",")&"""" & Chr(13) & Chr(10)'PREZZO DI VENDITA ATTUALE
     Command = Command & "TEXT 191,81,""TSS32.BF2"",0,2,3,""€ "&LabelPrezzoOfferta.Text.Replace(".",",")&"""" & Chr(13) & Chr(10)'PREZZO DI VENDITA ATTUALE
     Command = Command & "TEXT 200,170,""3"",0,1,1,""FINE "&LabelDataOfferta.Text&"""" & Chr(13) & Chr(10)'DATA FINE OFFERTA
 Else
     Command = Command & "TEXT 70,80,""TSS32.BF2"",0,3,4,""€ "&LabelPrezzoVenditaText.Text.Replace(".",",")&"""" & Chr(13) & Chr(10)'PREZZO DI VENDITA ATTUALE
     Command = Command & "TEXT 71,81,""TSS32.BF2"",0,3,4,""€ "&LabelPrezzoVenditaText.Text.Replace(".",",")&"""" & Chr(13) & Chr(10)'PREZZO DI VENDITA ATTUALE
 End If

 Command = Command & "BARCODE 0,200,""128"",50,1,0,2,2,"""&AutoCompleteEditText1.Text&"""" & Chr(13) & Chr(10)'BARCODE
 Command = Command & "TEXT 265,195,""3"",0,1,1,"""&LabelCodiceArticoloText.Text&"""" & Chr(13) & Chr(10)'COD ARTICOLO
 Command = Command & "TEXT 265,225,""3"",0,1,1,"""&LabelIdFornitoreText.Text&"""" & Chr(13) & Chr(10)'ID FORNITORE
 DateTime.DateFormat="yyyy-MM-dd"
 Command = Command & "TEXT 265,255,""3"",0,1,1,"""&DateTime.Date(DateTime.Now)&"""" & Chr(13) & Chr(10)'DATA
 Command = Command & "PRINT 1" & Chr(13) & Chr(10)
 Log(Command)
 AStream.Write(Command.GetBytes("UTF8"))
End Sub 

Upvotes: 0

Views: 56

Answers (0)

Related Questions