Printing lines to printer

hadinatayp

Well-known member
Joined
Feb 8, 2006
Messages
95
Programming Experience
Beginner
how make the printer print some lines that we want and the printer stop(wait)
until we make him print another line?

like the one at supermarket cashier, when the cahier scan for a product's barcode the printer will print the product's name and stop.

Or like POS (point of sale) printer that prints a list of products that you purchased and stop, so the cashier can tear the paper and give it to you.
 
Native .Net printing is document based and will only print full pages (with zero or more lines of data).
What you can do is to send raw data to printer and manage page etc yourself by Win32 spooler functions. Here is a link to the article "How to send raw data to a printer by using Visual Basic .NET" http://support.microsoft.com/?scid=kb;EN-US;322090
 
wow!!!
thanks alot broo !!!

BUT,
when i run the program, an error shows up state "PInvokeStackImbalance was detected"

"A call to PInvoke function 'WindowsApplication1!WindowsApplication1.RawPrinterHelper::OpenPrinter' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature."

What happened? how can i solve the problem?

thx.
 
Last edited:
Try changing the OpenPrinter function definition of pd parameter to IntPtr (it now says Long). Then you would also have change the '0' in the OpenPrinter call to 'IntPtr.Zero'. I only got a virtual PDF printer here, so I can't try this out myself.
 
Great!! ...lucky strike :)
 
Back
Top