Hi Paddy !
On Tue, 13 Jul 2004 10:10:00 +0200, "Paddy" <wa**********@a ll.here> wrote:
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.EventArg s e)
{
PrintDialog pd = new PrintDialog();
pd.PrinterSetti ngs = new PrinterSettings ();
if (DialogResult.O K == pd.ShowDialog(t his))
{
MemoryStream memStrm = new MemoryStream();
StreamWriter sw = new StreamWriter(me mStrm);
sw.WriteLine("\ x02L");
sw.WriteLine("H 07");
sw.WriteLine("D 11");
sw.WriteLine("1 911008020000251 0K Ny linje");
sw.WriteLine("1 911008010000251 0K OHM 1/4 WATT");
sw.Flush();
sw.WriteLine("1 a62100000000505 90PCS");
sw.WriteLine("E ");
sw.WriteLine("" );
sw.Flush();
memStrm.Positio n = 0;
LabelPrint.Send DocToPrinter(pd .PrinterSetting s.PrinterName,m emStrm);
sw.Close();
</snip>
<snip2>
private void btn3_Click(obje ct sender, System.EventArg s e)
{
PrintDialog pd = new PrintDialog();
pd.PrinterSetti ngs = new PrinterSettings ();
if (DialogResult.O K == pd.ShowDialog(t his))
{
string p = pd.PrinterSetti ngs.PrinterName ;
LabelPrint.Send StringToPrinter (p,"\x02L"); // ^BL
LabelPrint.Send StringToPrinter (p,"H07");
LabelPrint.Send StringToPrinter (p,"D11");
LabelPrint.Send StringToPrinter (p,"19110080100 002510K OHM 1/4 WATT");
LabelPrint.Send StringToPrinter (p,"1a621000000 0050590PCS");
LabelPrint.Send StringToPrinter (p,"E");
LabelPrint.Send StringToPrinter (p,"");
}
}
</snip2>
Best wishes
Kai Bohli
ka***********@o nline.no
Norway