没有对话框的IHTMLDocument2打印 [英] IHTMLDocument2 Printing without Dialog Box
本文介绍了没有对话框的IHTMLDocument2打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在研究自动打印HTML
发票的项目.因为我需要保持CSS
格式,所以这特别具有挑战性.
I've been working on a project that automatically prints HTML
invoices. It's been particularly challenging as I've needed to keep the CSS
formatting.
根据建议,我发现自己使用IHTMLDocument2
进行打印.我应该能够:
Following advice, I've found myself using IHTMLDocument2
to carry out my printing. I'm supposed to 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);
第二个参数指定是否产生Printer Options
框,但这无济于事.我已经读到,使用PRINT
总是会出现一个对话框-但是我找不到替代方法.
The second argument specifies whether to produce the Printer Options
box, but it doesn't help. I've read that using PRINT
will always result in a dialog box - however I haven't been able to find an alternative.
有什么想法吗?
推荐答案
查看全文