|Hello, I am writing a very simple app that is trying to launch a pdf viewer when a button is pressed or a selection is changed in a list.
I have the structure to generate an event when the selection is changed and I have the path to the pdf file; e.g. 'Assets/pdf/filetoopen.pdf'
I have been trying all kinds of methods without success;
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile pdfFile = await local.GetFileAsync((DetailsLongListSelector.SelectedItem as ContentViewModel).pdfLocation);
success = await Windows.System.Launcher.LaunchFileAsync(pdfFile);
That fails when using GetFileAsync.
I had thoughts about its due to access permissions and may need to copy to temporary storage before using, but I cant seem to make that work.
Is there any preferred method to open an pdf ?
OK I have managed to get it to launch by using:
StorageFolder appFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile pdfFile = await appFolder.GetFileAsync((DetailsLongListSelector.SelectedItem as ContentViewModel).pdfLocation);
if (pdfFile != null)
bool success = await Windows.System.Launcher.LaunchFileAsync(pdfFile);
The main problem was I needed to use the ApplicationModel instead of Storage.ApplicationData.
Now I have an issue with Adobe stating that the file already exists "do you want to replace ?"
Is there any way to force Adobe to overwrite ?