Hi All,
This might seem like a dumb question, but I just can't figure out what is wrong with my code, because it always worked and is working when I debug.
I have a pdf file that I am displaying using the webbrowser control. Now the path to the pdf should be the installation directory where my application is installed. The thing is it is placing the pdf there, but my code cannot find the file. However when I display the path in a textbox it is pointing to the file in my install directory. So I am totally lost.
This is my code:
private void btnGettingStarted_Click(object sender, EventArgs e)
{
GeneralLoader.ShowSplashScreen();
_viewModel.OpenPDFViewer("Getting Started", AppDomain.CurrentDomain.BaseDirectory + "PDF Files\\Getting_Started.pdf");
GeneralLoader.CloseForm();
}
That goes to a class with the following code:
public void OpenPDFViewer(string name, string pdfUrl)
{
PDFViewer viewer = new PDFViewer(name, pdfUrl);
viewer.Show();
}
And the PDFViewer form has the following code:
public partial class PDFViewer : Form
{
string PDFName;
string PDFUrl;
public PDFViewer(string name, string pdfUrl)
{
InitializeComponent();
PDFName = name;
PDFUrl = pdfUrl;
LoadDocument();
}
public void LoadDocument()
{
this.Text = PDFName;
PdfDocument.Navigate(PDFUrl);
}
private void PDFViewer_Load(object sender, EventArgs e)
{
this.Activate();
}
}
I cannot seem to find the answer to this problem. the path to the pdf just won't work after application is deployed, but when the application is being debugged, then it is working fine.
Any help would be appreciated.