I need to print a text content, I use this code for this, but don’t work, the paper is empty
PrintDocument myPrintServer = new PrintDocument();
myPrintServer.PrinterSettings.PrinterName = @"\\servername\printerName";
StringReader myReader = new StringReader("test string content");
myReader.Close();
Could someone tell me what is wrong?
Thank you
You must add code to render your string to the graphics context of the PrintDocument object you create. See the example on MSDN and note how they use the event handler to render text to the page:
and then:
…
…
If you want to send pre-formatted data directly to the printer from C#, you can use the RawPrinterHelper defined in this MSDN example and do things like
string s = “Hello”; // device-dependent string, need a FormFeed?