I am selecting a folder containing PDF
's and I want to display those pdf
's in the dxpdf
viewer.
This is my code for Load Button:
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);
}
}
This is the code for 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);
}
The PDF
files are named prefixed with 'ABC_'
The Object
to add PDF Files
from .xmal
file is 'PDFViewer'
How do I display .pdf
files in the pdfviewer
? It can be a single file or multiple files.