从WinJS应用程序打开PDF文件

从WinJS应用程序打开PDF文件

问题描述:

我有一个应用程序,用户可以在其中单击一个按钮,并应向其显示存储在该应用程序中的PDF.

I've got an application in which the user clicks a button, and should be presented a PDF that is stored in the application.

他们可以在应用程序内部查看PDF,也可以启动本机Windows PDF查看器.

They can view the PDF internally in the app, or launch the native windows PDF viewer, either way is fine.

如何为单击按钮以启动PDF文件视图提供链接/事件处理程序?

How can I provide a link / event handler for the button click to launch a view of a PDF file?

使用 LaunchFileAsync函数

说明:使用指定的选项启动与指定文件关联的默认应用.

description: Starts the default app associated with the specified file, using the specified options.

示例代码:

Windows.System.Launcher.launchFileAsync(file, options).done( /* Your success and error handlers */ );