Hi,
from a CLI application (or library) in C#, i can send something to the printer, select it etc (using PrintDocument
and PrinterSettings
.
How can I send to a printer a rendered HTML page? Like instantiating in memory IE and use it to render / print the page? This without opening an actual browser window (ex, do it all from the command line).
This is where I've got so far:
using mshtml;
string sWebPage = System.IO.File.ReadAllText(@"C:\Users\me\Desktop\h.html");
object[] oPageText = { sWebPage };
HTMLDocumentClass myDoc = new HTMLDocumentClass();
IHTMLDocument2 oMyDoc = (IHTMLDocument2)myDoc;
oMyDoc.write(oPageText);
//oMyDoc.execCommand("print", false, 0); <- does not wok
Thanks