Welcome to LightSwitch Desktop Edition > PdfViewer for LightSwitch Overview > PdfViewer for LightSwitch Quick Start > Adding a PDF from a File System |
If you prefer not to add a PDF via a URL, you can add one in from your file system.
Add a PdfViewer Screen
Add a Method
Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke(() =>
{
// request file name
System.Windows.Controls.OpenFileDialog ofd = new System.Windows.Controls.OpenFileDialog();
ofd.Filter = "Pdf files (*.pdf)|*.pdf";
if (ofd.ShowDialog() == true)
{
ViewerDataLocation = ofd.File.FullName;
}
}
);
Choose a PDF
Now you can choose a PDF using the Open File button.
The PDF will now appear in the PDFViewer.