How to open pdf files in windows 8 application using c#?

故事扮演 提交于 2019-12-08 14:17:28

you can use the LaunchFileAsync method of the Windows.System.Launcher class.

Take a look at this: http://msdn.microsoft.com/en-us/library/windows/apps/hh701465.aspx

The solution is, you can open pdf files on Windows.ApplicationModel.Package.Current.InstalledLocation...

So, put the pdf on local folder and open from it.

    StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
     StorageFile file= await localFolder.GetFileAsync("myFile.pdf");
     if (file != null)
                {
                    // Set the option to show the picker
                    var options = new Windows.System.LauncherOptions();
                    options.DisplayApplicationPicker = true;

                    // Launch the retrieved file
                    bool success = await Windows.System.Launcher.LaunchFileAsync(file, options);
                }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!