By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

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

P: 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
Share this question for a faster answer!
Share on Google+

Post your reply

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