简体   繁体   English

使用Adobe或任何PDF阅读器阅读PDF文件

[英]Reading PDF files using Adobe or any PDF reader

In my application I have all the PDF in a folder called PDF with names like First.pdf , Second.pdf. 在我的应用程序中,我将所有PDF都放在名为PDF的文件夹中,其名称类似于First.pdfFirst.pdf Second.pdf.

I have LongListSelector with some items in it. 我有LongListSelectorLongListSelector有一些项目。 When I click on each item I have the selected item value stored in a string. 当我点击每个项目时,我将所选项目值存储在一个字符串中。

private void longListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MyObject item  =  longListSelector.SelectedItem as MyObject;
            MessageBox.Show(item.ST);
        }

The above code gives me names like First , Second . 上面的代码给出了像FirstSecond这样的名字。

Now I just want to open the corresponding pdf file with that name. 现在我只想打开具有该名称的相应pdf文件。

EDIT 编辑

I am working on Windows Phone 8 application and the PDF are in the folder MyPdf inside my app. 我正在使用Windows Phone 8应用程序,PDF在我的应用程序内的MyPdf文件夹中。

**EDIT 1 ** **编辑1 **

private async void LaunchPDF(string name) 
        {
            StorageFile pdfFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("xyz.pdf");
            // Launch the pdf file.
            Windows.System.Launcher.LaunchFileAsync(name);
        }

Getting error in this line Windows.System.Launcher.LaunchFileAsync(name); 在此行中获取错误Windows.System.Launcher.LaunchFileAsync(name); //has invalid arguments. //包含无效参数。

Can I use My Emulator to test if the pdf is opening or not ? 我可以使用My Emulator来测试pdf是否打开?

您可以使用此组件: PdfViewer ,但该组件不是开源的。

Assuming that the the application is getting developed targeting Windows Phone OS 8. 假设该应用程序正在针对Windows Phone OS 8开发。

You can use launcher to open it. 您可以使用启动器打开它。

// Get the file
StorageFile pdfFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("xyz.pdf");

// Launch the pdf file.
Windows.System.Launcher.LaunchFileAsync(xyz.pdf);

A LINK about URI Launchers 关于URI启动器的链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM