I want to do something like that:
Expand|Select|Wrap|Line Numbers
- void doc_PrintPage(object sender, PrintPageEventArgs e)
- {
- // draw a rectangle
- e.Graphics.DrawRectangle(Pens.Black, new Rectangle(10, 10, 100, 100));
- // Send a text to printer
- PrinterSettings ps = new PrinterSettings();
- RawPrinterHelper.SendStringToPrinter(ps.PrinterName, "test string");
- // draw an ellipse
- e.Graphics.DrawEllipse(Pens.Black, new Rectangle(10, 200, 100, 100));
- }
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.