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

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

P: 1
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));
  6.     // Send a text to printer
  7.     PrinterSettings ps = new PrinterSettings();
  8.     RawPrinterHelper.SendStringToPrinter(ps.PrinterName, "test string");
  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.