Open PDF using C#-- Windows 8 Store Application -
i want able open pdf using native windows reader application when user clicks on button. far able use following code open files end (.png) extension. however, when let link open (.pdf) file following error.
the system cannot find file specified. (exception hresult: 0x80070002) the file destination correct.
here code:
private async void btnload_click(object sender, routedeventargs e) { // path file in app package launch string imagefile = @"data\healthcare-flyer.pdf"; var file = await windows.applicationmodel.package.current.installedlocation.getfileasync(imagefile); if (file != null) { // set option show picker var options = new windows.system.launcheroptions(); options.displayapplicationpicker = true; // launch retrieved file bool success = await windows.system.launcher.launchfileasync(file, options); if (success) { // file launched } else { // file launch failed } } else { // not find file } } }
when add pdf document in project, have change it's build action.
right click on pdf document.
click on properties.
change build action none content
Comments
Post a Comment