I need to send content to printer in C# .NET the same way as PRINT
command does.
I have Godex thermal printer with QLabel software bundled. Now it has the option to save the label as a command that you can pass to printer with command prompt PRINT
command. The file looks like this:
^Q80,3
^W100
^H10
^P1
^S3
^AD
^C1
^R2
~Q+0
^O0
^D0
^E35
~R200
^L
Dy2-me-dd
Th:m:s
AH,0,0,1,1,0,0,X
AH,744,0,1,1,0,0,X
AH,746,560,1,1,0,0,X
AH,0,550,1,1,0,0,X
AG,160,208,1,1,0,0,
AA,234,283,1,1,0,0,Haloo
E
That works when i do something like this:
net use LPT2 \\localhost\godexUsbPrinter /yes
print /D:LPT2 label.cmd
And it prints my label out nicely.
Now, if i open this in notepad and print, it just prints me this text.
I wonder what does PRINT
command do under the hood and how can i program my C# based program to replicate the behaviour? Because when i implement printing logic, it just prints me the plain text as notepad does.
I know i could call a PRINT
command with Process.Start from C#, but i need to replace some placeholder value in the label template all the time. I could create a temporary file on the disk and print that, but i would prefer to avoid such a scenario.