page ejecting on printer

  • Thread starter Thread starter Paddy
  • Start date Start date
P

Paddy

Is it possible to send (char)12 to the printer to
make it eject?
If so, how can that be done?
If not, how can a page be ejected differently?

Many thanks.
 
Hi Paddy !

The only way I know of that makes it possible to send control codes to the printer, is to send it
directly to the port. This is easier than you probably think, cause all you need to know it the name
of the printer (and since you've already printed a page, you have that). Se my replies to the thread
"Printer language & sending commands" on July 6th.

If this is a standard printer (laser or ink) though, it should be enough to send the standard "end
of doc" thingy.

HTH


Is it possible to send (char)12 to the printer to
make it eject?
If so, how can that be done?
If not, how can a page be ejected differently?

Many thanks.

Best wishes
Kai Bohli
(e-mail address removed)
Norway
 
Hi Paddy !

Could you please repeat your message of July 7 Th?

Sure !

Note that the code snips ar intended for use with a label printer. But the article should cover what
you're looking for (I think).

You need to send the data raw to the printer, otherwise Windows will eat the control codes alive.

First of all read this article:
HOW TO: Send Raw Data to a Printer by Using Visual C# .NET
http://support.microsoft.com/?kbid=322091

Copy the article code into a classfile.
Then you'll have to do something like the code below. (sorry about the formating )

(Note: The SendDocTo Printer is my addon to the article, where I have added a few methods so I could
pass a memorystream, and stream from a embedded resource file etc.
I have a lot of experience with Eltron Orion/2443 and Zebra 2443/2444 and DataMax label printers,
but almost everything I've done is done in Delphi. I've jsut started porting this stuff to C#
myself. Anyway, if you're stucked - contact me and I can see if I can help you - no garantee though
:)


<snip>
private void btnPrint2_Click(object sender, System.EventArgs e)
{
PrintDialog pd = new PrintDialog();
pd.PrinterSettings = new PrinterSettings();
if (DialogResult.OK == pd.ShowDialog(this))
{
MemoryStream memStrm = new MemoryStream();
StreamWriter sw = new StreamWriter(memStrm);
sw.WriteLine("\x02L");
sw.WriteLine("H07");
sw.WriteLine("D11");
sw.WriteLine("19110080200002510K Ny linje");
sw.WriteLine("19110080100002510K OHM 1/4 WATT");
sw.Flush();
sw.WriteLine("1a6210000000050590PCS");
sw.WriteLine("E");
sw.WriteLine("");
sw.Flush();

memStrm.Position = 0;
LabelPrint.SendDocToPrinter(pd.PrinterSettings.PrinterName,memStrm);
sw.Close();

</snip>

<snip2>
private void btn3_Click(object sender, System.EventArgs e)
{
PrintDialog pd = new PrintDialog();
pd.PrinterSettings = new PrinterSettings();
if (DialogResult.OK == pd.ShowDialog(this))
{
string p = pd.PrinterSettings.PrinterName;
LabelPrint.SendStringToPrinter(p,"\x02L"); // ^BL
LabelPrint.SendStringToPrinter(p,"H07");
LabelPrint.SendStringToPrinter(p,"D11");
LabelPrint.SendStringToPrinter(p,"19110080100002510K OHM 1/4 WATT");
LabelPrint.SendStringToPrinter(p,"1a6210000000050590PCS");
LabelPrint.SendStringToPrinter(p,"E");
LabelPrint.SendStringToPrinter(p,"");
}
}
</snip2>




Best wishes
Kai Bohli
(e-mail address removed)
Norway
 
Hi Kai,

I am using the (very slightly modified) code in an application and
it is running ok. Thank you for your generous offer of further help.
Perhaps in due course. Right now I am doing fine, thanks to your
support.

Regards,
Paddy
www.pearltree.nl
 
Back
Top