When importing a PDF document, opening the stream in using statement, and using the default constructor of the PdfDocumentSource class, an exception is thrown:
using (Stream stream = ofd.OpenFile())
{
this.pdfViewer.DocumentSource = new PdfDocumentSource(stream);
}
using (Stream stream = ofd.OpenFile())
{
PdfImportSettings importSettings = new PdfImportSettings
{
CopyStream = true
};
this.pdfViewer.DocumentSource = new PdfDocumentSource(stream, importSettings);
}