c# - What does Notepad do differently under the hood than the PRINT command? -


I need to send content to the printer in C # .NET, as print

I have a Godex thermal printer in which the software is bundled. Now he has the option to save the label as a command that you can send with the command prompt to the 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 F: 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, Halo E   

This works when I do something like:

  Pure use LPT2 \\ local host \ godexUsbPrinter / yes print / d: LPT2 label. Cmd  < / Pre> 

and it prints my labels well.

Now, if I open it in Notepad and Print, it just prints this text to me.

I wonder how the print commands do under the hood and how can I program my C # based program to replicate the behavior? Because when I apply the printing argument, it prints plain text as a notepad to me.

I know that I can call a print command with the process. Starting with C #, but I need to replace some placeholder value in the label template at all times. I can make a temporary file on the disk and print it, but I like to avoid this kind of scenario.

To be honest, the question title is incorrectly print exactly It also does nothing, it just flies all its input on the printer, it is notepad that, through the Windows print system, sending different commands for paging and line endings, and finally the data that you want to print . The code you display is raw printer data, so you have to send it 'raw' and not in the form of text. So technically this is a duplicate.

How to do this, explained. This is using P / InCoison using winspool.Drv .

Comments