Printing to a printer

  • Thread starter Thread starter Ryan Gregg
  • Start date Start date
R

Ryan Gregg

I've got a dot matrix printer that I need to print a line at a time to.
This is being used for an audit log on an application and every event
that occurs needs to print out right as it occurs.

I've previously had this working well in a serial communication method
where I talk directly to the printer using control codes and what not.
However, it seems that the higher ups want to be able to use a network
printer or other Windows-configured printer device.

They claim that it's possible to do this, and I don't know if they're
right or not, but I can't seem to find a good way to do it in .NET.

Does anyone know if this is possible at all for Windows to do (I assume
it is because I'm sure this is something that other applications do from
time to time), and does anyone have an idea of how to do it?

Essentially I'm looking for some sort of a method where I can give it
the name or device ID of a printer and then send single lines of text to
the printer which are printed (without doing a form feed). It's alright
if it "ties up" the printer with a document that is always being
spooled/printed, because the printer will only be used for this purpose.

Thanks in advance.

Ryan
 
Ryan,
I'll show my knowlege here or my ignorance of network
printers: What they are probably talking about is the old
line printers or ancient devices they saw many years
ago. I don't know of a way to use a network printer
(with a network queue) for a dedicated device, even if
you don't give anyone else rights to use it, you still
have the problem that the interface is set up to print
documents--whole documents at a time.

Now having said this, it doesn't stop you from making a
small server (socket communication), and sending
information to a server that has a printer plugged into a
port that you can control manually. You will probably
have to go down to the C/C++ level to gain access to the
printer at that low of level. (I could be wrong, I'm not
an all exhaustive reference for .Net yet)

So the answer is: is it do-able, yes! Did your bosses
ever see it in something that resembles your
environment: very little chance! Can you do it in C#:
well partly at least!
 
Thanks for the answer. I was pretty sure it was possible, but I still
have no idea of how to go about doing it. It looks like everything in
..NET printing is pretty much strictly document-centric, which looks like
it won't be of any use for what I'm trying to do.

Previously my application worked by talking to a serial printer directly
through a class that uses WinAPI to access the serial ports. This
worked well until today when I have a printer that isn't working via the
serial port and I need to get printing out my audit log (and it's
Saturday, that figures).

I've checked the cable wiring is correct, but the printer still won't
respond, so I think the serial input on the printer may be wrong/not
functional. This leaves me with either the USB or Parallel interface on
the printer to try and use, but no easy way to access those ports for
printing.

Thanks for your time and information though.

Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top