Let me make a few things clear first, because this is likely to involve more than just that.
First, that printer is absolutely ancient by the standards that ordinarily show up in a forum that is dedicated to using VB.NET in the IT industry. (I'm sure that you know this already.) However, things being the way they are, printers get used until they don't print anymore, and most businesses get by using equipment that they already own, and programmers like you and I need to be able to get the job done, especially when it gets tedious...like now.
Dot-matrix printers have widely varying capabilities, which is why I mentioned GetDeviceCaps
in the Win32 API. I must admit to you that I know far less about .NET than the Win32 API. I responded to your post because I suspect that you will need to use Win32 for this printer. For one thing, there is the issue of these escapes I keep talking about. Another thing is that some printers require a technique called banding for output, but I doubt that is the case with your Epson. GetDeviceCaps
will tell you that very directly. (You must make a call to GetDeviceCaps
for each type of capability you want to know about.)
As you have seen, text output to this printer works as expected. It is the graphics capabilities that we are unaware of, and I need to make a side trip into how printing is done 'under the hood' in order to make this more clear to you.
In Windows, the output device is abstracted (hidden, more or less) through device contexts. (A display and printer use the same type of device context, which is implemented in the driver.) The device context is your path to the device...through the driver. DrawText is GDI+, but eventually, it will call TextOut
from GDI. You can use strings, and it will get printed in whatever font is selected into the device context at the time the call is made. I have not tried sneaking escapes into normal text output, but I suspect that it is not simple to do, if it is even possible at all. (It would involve sneaking ASCII code 27 into what is otherwise a normal string. Where you see the word ESC, it means ASCII code 27, or just the value 27.) So then, when I said that you needed to send ESC * to switch to bit image mode, that means to use 27 32 42 0 FYI, text is a special form of graphics, where the text is painted (called rasterization) by the device driver...not Windows.
The functions that you use for sending escapes are from the GDI (gdi32.dll) component of Windows. They are Escape
is for pre-defined system escapes that Windows already knows, and that are standardized across all printers. (STARTDOC/ENDDOC, NEWFRAME, ABORTDOC, etc.) ExtEscape
is for sending specific escapes, like the ones in the chart I made for you.
Now, as far as printing in GDI, there are a few places that you need to work on so that you know what you are dealing with more precisely. The first thing that you need to do is get a handle to a device context for that printer. After that, you can use GetDeviceCaps
to (optionally, display the printer settings dialog, which is from the driver.) set the printer up with the proper settings. GetDeviceCaps
will tell you if there is graphics capability, and the extent of that capability. DocumentProperties
can be used to set your stock up, and some other things, too...it depends on your driver, and its not very easy to use at all. (I have developed a method, but unless you know the format of the extra information...it might not be of much use as a replacement for the escapes that you will have to use anyway.)
Okay, I have made a lot of work for myself...I will select functions from GDI and give you some sample code that you can use to get this figured out. One thing I want to make clear is that one of the [only] advantages of writing this code is that the escapes are standardized across all printers that support the Epson ESC/P2
control set, which is a lot. The other non-Postscript standard is IBM ProPrinter
, which your LQ 680 also supports, and which only differs in the meaning of the codes...the semantics are the same, which is important to you as a developer supporting ancient printing methods.
I will post you some useful code soon.