2
HTML 문서 :인쇄 나는 다음과 같은 코드를 성공적으로 HTML 문서를 인쇄하고 있습니다
using (WebBrowser webBrowser = new WebBrowser())
{
webBrowser.DocumentText = text;
while (webBrowser.ReadyState != WebBrowserReadyState.Complete)
Application.DoEvents();
InternetExplorer internetExplorer = (InternetExplorer)webBrowser.ActiveXInstance;
internetExplorer.PrintTemplateTeardown += InternetExplorer_PrintTemplateTeardown;
internetExplorer.ExecWB(OLECMDID.OLECMDID_PRINT, OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER);
while (!documentPrinted)
Application.DoEvents();
internetExplorer.PrintTemplateTeardown -= InternetExplorer_PrintTemplateTeardown;
}
두 가지 문제 : 인쇄 된 용지는 헤더 (page 1 of 1
)과 바닥 글을 가지고
- (
about:blank
및date
). 그것들 없이는 어떻게 인쇄 할 수 있습니까? - 인쇄 된 용지는 실제 HTML 페이지 내용보다 훨씬 길다. 내용이 끝나면 어떻게 인쇄를 멈출 수 있습니까?
을 FYI : http://stackoverflow.com/a/19172580/1768303 – Noseratio
감사합니다. 스레드는 유익하지만 인쇄중인 웹 페이지를 변경할 수 없습니다. 페이지를 변경하지 않고 해당 머리글과 바닥 글을 지우는 방법이 있습니까? – toy4fun
예, 맞춤 헤더/꼬리말 (빈 것을 포함하여)을 설정할 수있는 'IDM_PRINT' 링크가 있습니다. – Noseratio