If you want to print pictures on an TSC printer from .Net you've got different options, the BITMAP command the, PUTBMP and the PUTPCX. But from the TSC .net dll only the downloadPCX command is directly available. The disadvantage is that PCX is a realy old graphic format. So converting a bmp, jpg, png to pcx isn't straightforward in .Net. Luckily you can do this with the ImageMagick commandline tools, the MagickNet .Net port doesn't support the commands needed to convert the image to a halftone image and a pcx file.
These are the commands needed to convert to halftone and then convert this halftone to pcx
Process.Start("C:\Program Files\ImageMagick-6.7.7-Q16\convert.exe", "sourceFile -colorspace Gray -ordered-dither h4x4a destinationFile")
Process.Start("C:\Program Files\ImageMagick-6.7.7-Q16\convert.exe", "destinationFile -colors 2 -depth 1 pcxFile")
Next you can print an image by using the following commands, the TSC dll should be present in the same directory as the executable
Private Declare Sub openport Lib "tsclib.dll" (ByVal PrinterName As String)
Private Declare Sub closeport Lib "tsclib.dll" ()
Private Declare Sub sendcommand Lib "tsclib.dll" (ByVal command_Renamed As String)
Private Declare Sub setup Lib "tsclib.dll" (ByVal LabelWidth As String, ByVal LabelHeight As String, ByVal Speed As String, ByVal Density As String, ByVal Sensor As String, ByVal Vertical As String, ByVal Offset As String)
Private Declare Sub downloadpcx Lib "tsclib.dll" (ByVal Filename As String, ByVal ImageName As String)
Private Declare Sub barcode Lib "tsclib.dll" (ByVal X As String, ByVal Y As String, ByVal CodeType As String, ByVal Height_Renamed As String, ByVal Readable As String, ByVal rotation As String, ByVal Narrow As String, ByVal Wide As String, ByVal Code As String)
Private Declare Sub printerfont Lib "tsclib.dll" (ByVal X As String, ByVal Y As String, ByVal FontName As String, ByVal rotation As String, ByVal Xmul As String, ByVal Ymul As String, ByVal Content As String)
Private Declare Sub clearbuffer Lib "tsclib.dll" ()
Private Declare Sub printlabel Lib "tsclib.dll" (ByVal NumberOfSet As String, ByVal NumberOfCopy As String)
Private Declare Sub formfeed Lib "tsclib.dll" ()
Private Declare Sub nobackfeed Lib "tsclib.dll" ()
Private Declare Sub windowsfont Lib "tsclib.dll" (ByVal X As Short, ByVal Y As Short, ByVal fontheight_Renamed As Short, ByVal rotation As Short, ByVal fontstyle As Short, ByVal fontunderline As Short, ByVal FaceName As String, ByVal TextContent As String)
Private Sub Print
Call openport(printername)
Call setup("44", "80", "4.0", "7", "0", "0", "0")
Call clearbuffer()
Call sendcommand("DIRECTION 1")
Call sendcommand("1") ' Or the number of printout per cut'
Call downloadpcx(Application.StartupPath & "\" & pcxFileName, "UL.PCX")
Call sendcommand("MOVE")
Call sendcommand("PUTPCX 20,20,""UL.PCX""")
Call printlabel("1", "1")
Call closeport()
End Sub