如何使用 c# 在 Windows 8 应用程序中打开 pdf 文件?
问题描述:
如何在 windows 8 应用程序中阅读 pdf 文件.在我的 windows 8 应用程序中如何打开 pdf 文件.
How to read the pdf files in windows 8 app .In my windows 8 application how to open the pdf files .
在清单文件中,我编写了以下代码.
In manifest file i wrote the below code.
<Extensions>
<Extension Category="windows.fileTypeAssociation">
<FileTypeAssociation Name="pdf">
<SupportedFileTypes>
<FileType>.pdf</FileType>
</SupportedFileTypes>
</FileTypeAssociation>
</Extension>
</Extensions>
和背后的代码.
string imageFile = @"Images\DX730_EN.pdf";
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
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);
if (success)
{
// File launched
}
else
{
// File launch failed
}
}
else
{
// Could not find file
}
我无法打开pdf文件.请告诉我错误在哪里?
i could not able to open the pdf file.please tell me where is error?
答
您可以使用 Windows.System.Launcher 类的 LaunchFileAsync 方法.
you can use the LaunchFileAsync method of the Windows.System.Launcher class.
看看这个:http://msdn.microsoft.com/en-us/library/windows/apps/hh701465.aspx