TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bharat Leel
NA
104
6.8k
Handle WebBrowser.ShowPrintDialog() close event not SHDocVw
Jun 21 2017 9:02 AM
To print document I have created separate WindowsApplication and each time I want to print any document I call that application with path as parameter and Print application have below code:
public static void Print(string path)
{
WebBrowser wb = new WebBrowser();
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);
wb.Navigate(path);
}
public static void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser wb = (WebBrowser)sender;
if (wb.ReadyState.Equals(WebBrowserReadyState.Complete))
{
((SHDocVw.WebBrowser)wb.ActiveXInstance).PrintTemplateTeardown += Print_PrintTemplateTeardown;
wb.ShowPrintDialog();
}
}
void Print_PrintTemplateTeardown(object pDisp)
{
_Application.Exit();
}
When I call Print aaplication, using "WebBrowser" control it loads document and show Print Dialog using "wb.ShowPrintDialog();".
On Print Dialog when I click Print or Cancel I got PrintTemplateTeardown event where I asks Application to Exit (To close application).
Now I want to remove "SHDocVw" dependency from my Print Application due to some security issue while installing on client's machine through Internet.
If I remove "SHDocVw", is there any alternate event or solution available that achknowledge me that PrintDialog is closed?
Reply
Answers (
2
)
How to Remove the Instructions Text in word in VSTO
how to make textbox values Global Variable in windows form