Reputation: 75
Is there any way to query the state of an IE plugin (Adobe Reader)? I have a situation where we present many multi-page reports to users through an embedded browser (the preferred pattern based on my research) hosted by a tab page. When the user navigates away from the report, usually to modify the data, they return to re-initialized Adobe Reader. This means their place was lost and expanded bookmark nodes have been collapsed.
Below is a simplified code snippet which I hope full expresses the nature of my problem.
Public partial class ReportView : UserControl
{
private System.Windows.Forms.WebBrowser webBrowser;
private MyNamespace.ReportGenerator reportGen;
private String currentPDFtempPath;
public ReportView()
{
InitializeComponent();
this.Leave += (o, e) => { /*how can I save current place in pdf?*/ };
this.Enter += (o, e) => { /*return user last place in large pdf*/ };
}
public void ViewReport(string reportName)
{
currentPDFtempPath = reportGen.GetReport(reportName);
webBrowser.Navigate(currentPDFtempPath);
}
private void RefreshReport()
{
webBrowser.Navigate(currentPDFtempPath); /*reinitializes Adobe Reader*/
}
}
public class ReportController
{
private DataModel model;
private ReportView view;
ReportController(DataModel m, ReportView v)
{
this.model = m;
this.view = v;
model.Changed += (o, e) => { view.RefreshReport(); }
}
}
Upvotes: 3
Views: 2756
Reputation: 46
If your user base has standardized to one version of Acrobat or continuously updates to the latest and greatest Acrobat, an alternate solution is to eliminate the webbrowser control and add a reference to the AcroPDF/AxAcroPDF library/active x control, which works from a windows form. I have used this in my company for the past 6 years and it has worked flawlessly.
Upvotes: 3