When's The Printer Done?

When's The Printer Done?

Post by brycelinds » Sat, 11 Oct 2003 09:00:56

I'm working on an office application that's going to need to print out
300+ billing statements. Since that seems like a lot, I'm thinking
that will slow things down, which would be bad. So then I thought
that it would be cool if I could just send a billing statement to the
printer when the printer wasn't busy printing. Send them to the
printer one-at-a-time.

System.Drawing.Printing.PrintDocument.EndPrint seemed to be the event
I wanted. It even says "Occurs when the last page of the document has
printed.". Unfortunately, it seems to fire every time a billing
statement is sent to the printer's spool. This means that all my 300+
billing statements get sent to the printer and then it prints them.

That's not what we're shooting for. I want to send the printer the
first billing statement, have it print it, send it the next billing
statement, have it print it, send it the next... etc.

Maybe I'm trying to do something weird, but it makes sense to me. It
would make it a lot easier to cancel the printing too. If I'm sending
billing statements to the printer one-at-a-time it would be easy to
flip a flag and have stop the loop that's sending the statements to
the printer.

Does anybody have any ideas? Surely I'm not trying to do the
impossible... right? Thanks for you help!


When's The Printer Done?

Post by Ron Alle » Sat, 11 Oct 2003 22:37:11

You should be able to get some information using WMI and the Win32_Printer
object. I would think that the Availability property should have what you
are looking for although you may have to experiment to see which of these
bits means exactly what you want.

Ron Allen