0

我正在选择一个包含PDF's 的文件夹,并且我想pdf在查看器中显示这些 's dxpdf

这是我的加载按钮代码:

private void LoadBtn_Click(object sender, RoutedEventArgs e)
{
    var dialog = new System.Windows.Forms.OpenFileDialog{
        Filter = @"PDF Files (*.pdf)|*.pdf",
        InitialDirectory = Environment.CurrentDirectory,
    };
    if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
        MessageBox.Show("Kindly Select PDF Files", "Error");
    else {
        var pdffolder = Path.GetFullPath(dialog.FileName);
        PDFSelections(pdffolder);              
    }
}

这是PDFSelections Function()的代码

private void PDFSelections(string pdffolder)
{
    _path2 = pdffolder;
    List<string> pdf = new List<string>();
    string pattern = @"\b(?i)ABC+_{1}[0-9]*\.(pdf)$";
    var matches = Directory.GetFiles(_path2).Where(file => Regex.Match(file, pattern).Success).Select(p => System.IO.Path.GetFullPath(p)).ToArray();
    foreach (string file in matches)
    pdf.Add(file);
    PDFViewer.AsyncDocumentLoad(file);
}

PDF文件以“ABC_”为前缀命名

从文件中Object添加的是“PDFViewer”PDF Files.xmal

如何在 中显示.pdf文件pdfviewer?它可以是单个文件或多个文件。

4

0 回答 0