[英]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.pdf
, First.pdf
Second.pdf.
I have LongListSelector
with some items in it. 我有
LongListSelector
, LongListSelector
有一些项目。 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
. 上面的代码给出了像
First
, Second
这样的名字。
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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.