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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dtnam
    New Member
    • Feb 2009
    • 1

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

    Hi,
    I want to do something like that:
    Code:
    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));
    }
    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 SendStringToPri nter() 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.
    Last edited by Frinavale; Feb 6 '09, 08:47 PM. Reason: Moved to C# Answers from .NET and added [code] tags
Working...