473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to send raw data to printer parallel with .NET printing process

1
Hi,
I want to do something like that:
Expand|Select|Wrap|Line Numbers
  1. void doc_PrintPage(object sender, PrintPageEventArgs e)
  2. {
  3.     // draw a rectangle
  4.     e.Graphics.DrawRectangle(Pens.Black, new Rectangle(10, 10, 100, 100));
  5.  
  6.     // Send a text to printer
  7.     PrinterSettings ps = new PrinterSettings();
  8.     RawPrinterHelper.SendStringToPrinter(ps.PrinterName, "test string");
  9.  
  10.     // draw an ellipse
  11.     e.Graphics.DrawEllipse(Pens.Black, new Rectangle(10, 200, 100, 100));
  12. }
this method is expose from a PrintDocument object.

The printer will print in two pages, the first one with "test string" text in it, and the second one with a rectangle and an ellipse, because the SendStringToPrinter() method will send the command to printer first, then, for the PCL printer, the .net framework will generate a PCL file with ecs E command at the beginning and end of the file. The first esc E command will reject the printer with "test string" in it, the second will print 2 shapes and reject.

I want it to print in a single page only, do you have any experience? They will save my life,

best regards and thank you.
Feb 6 '09 #1
0 2438

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: KohlerTommy | last post by:
In my application I need to give the user the ability to print duplex if the selected printer supports duplex printing. Many of the printer options do not make much sense in my application, and...
4
by: Angel Mazo | last post by:
Recently, Terminal Server was set-up by site server responsible to give remote access to some users. I tested it and application runs ok. Now users get Error # 2202 when they try to...
3
by: RC | last post by:
I am using docmd.printout to send Reports (formatted as labels) to a barcode label printer. I need to collate the labels so that I print lable 1 twice, then label 2 twice, then label 3 twice, etc....
2
by: Ryan Gregg | last post by:
I've got a dot matrix printer that I need to print a line at a time to. This is being used for an audit log on an application and every event that occurs needs to print out right as it occurs. ...
4
by: Charlie | last post by:
I need to print using the VB.net printing classes to a tractor feed printer. My client loaned me a Panasonic kx-p2123 to set up the job. I was able to print from Notepad using the Generic/Text...
13
by: Susan Beebe | last post by:
I have downloaded the code described in Microsoft article Q154078. I am trying to send raw ZPL (zebra barcode printer) code from Microsoft access. It works just fine if I hard code the actual...
1
by: hasanainf | last post by:
Hi all and thanking you all in advance for your help My client wants to use a receipt printer. Since I have never used one before I have some questions. 1. Unlike other printers which are set...
1
by: AM | last post by:
What I am trying to do is write raw data to a USB to parallel adapter to control an external device (as I dont have a parallel port) using VC++.net or C# The adapter is not a true parallel port...
8
by: Toni | last post by:
How to use POS Printer in .NET. I am searching by google but every code doesn't wok. I need some code (VB or C#) for printing on POS printer (printer for bills, bus, train or boat tickets snd...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.