473,758 Members | 2,919 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

page ejecting on printer

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.
Nov 16 '05 #1
5 5515
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
On Sun, 11 Jul 2004 20:58:37 +0200, "Paddy" <wa**********@a ll.here> wrote:
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
ka***********@o nline.no
Norway
Nov 16 '05 #2
Please couild you show me how to send an end of doc thingy?

"Kai Bohli" <ka****@online. nospam> wrote in message
news:h5******** *************** *********@4ax.c om...
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
On Sun, 11 Jul 2004 20:58:37 +0200, "Paddy" <wa**********@a ll.here> wrote:
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
ka***********@o nline.no
Norway

Nov 16 '05 #3
Could you please repeat your message of July 7 Th?
Paddy.

"Kai Bohli" <ka****@online. nospam> wrote in message
news:h5******** *************** *********@4ax.c om...
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
On Sun, 11 Jul 2004 20:58:37 +0200, "Paddy" <wa**********@a ll.here> wrote:
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
ka***********@o nline.no
Norway

Nov 16 '05 #4
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
Nov 16 '05 #5
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

"Kai Bohli" <ka****@online. nospam> wrote in message
news:9s******** *************** *********@4ax.c om...
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

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2716
by: Mike M. | last post by:
I'm trying to print the contents of a Flexgrid using printer.print. Everything works fine unless the number of entries in the grid cause it to not fit on a single 8.5x11 page anymore. The printer only prints to the end of the page and does not continue to the next page. Is there any way to do this?? Thanks! The simple code I have is as follows: Private Sub cmdPrint_Click() Printer.Orientation = vbPRORLandscape Printer.PaintPicture...
2
8376
by: Yaron Cohen | last post by:
Hi, I would like to ask for your help. I am using IE5.5. I have a wide page with horizontal scroll bar. The problem is that I get only 1 page when printing it using "file->print" or "window.print".
4
1551
by: Dan | last post by:
Hi, I have an asp.net page i have made that creates an invoice based on the invoice id given. It works fine but the problem i have is i now want to loop through my database and grab all the invoice numbers. As it grabs each invoice number i want to pass it into my asp.net page, execute it and display it so that each invoice falls on its own page leaving
7
3037
by: Michael Galvin | last post by:
I am trying to use Python to send to the printer a calender filled with a mix of text and simple graphics. I want to draw on the printed page something like a table with 6 rows and 7 columns to represent a calendar. I want to place text precisely within those boxes on the printed page. I am using Python 2.4 on Windows XP I was in the past able to do this within Visual Basic using its printer object. Visual Basic's printer object uses...
15
8635
by: priyasmita_guha | last post by:
Can anyone give me the code in C for ejecting the CD-drive ? Thanks in advance!
1
4358
by: anilkumarkp | last post by:
Hai I have to print a receipt in pre-printer stationary with bar code, My paper size is 4", i have set the paers size as Printer.ScaleMode = 1 ' vbTwips Printer.Height = 4 * 1440 Printer.width = 8 * 1440 but after priting this, when i put Printer.EndDoc, it is skiping the all 12" paper, in this 12" i have to print 3 receipt (4x3). If i have not used the Printer.EndDoc it is not going to the spooler,
1
3328
by: christianlott1 | last post by:
This is easy to do in word but is it possible in access? I want the first page to print on company letterhead and other pages to print on regular paper. Some of the pages I want landscape, others I want to remain portrait. The printer properties only allow me to set at design time. Stuff like this doesn't work: Private Sub Report_Page()
0
934
by: p247nepal | last post by:
I need to stop the printer in specific time, the main problem is that printer rolls whole paper (A4) but i need to stop rolling where the printable data are finished. It rolls whole page even if there are few lines printed.
18
11311
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing classes, for each of the checked rows in the GridView. This works fine in the Visual Studio 2005 development environment on localhost. But, when I move the page to the web server, I get the error "Settings to access printer...
0
9492
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9299
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10076
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7287
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5332
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3832
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2702
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.