I worked on a project that automatically prints HTML invoices. This was especially difficult since I needed to format the CSS .
Following the tips, I found that IHTMLDocument2 used to do my printing. I should be able to:
mshtml.IHTMLDocument2 doc = new mshtml.HTMLDocument() as mshtml.IHTMLDocument2; doc.write(htmlContent); //htmlContent is a string of HTML doc.execCommand("PRINT", false, null);
The second argument indicates whether to create a Printer Options field, but this does not help. I read that using PRINT will always lead to a dialog box, however I could not find an alternative.
Any ideas?
source share