Completed
Last Updated: 09 Oct 2020 13:18 by ADMIN
Release LIB 2020.3.1012 (12/10/2020)
Daniel
Created on: 06 Oct 2020 10:49
Category: PDFViewer
Type: Bug Report
1
PDFViewer: ArgumentNullException is thrown when importing a PDF document using the default constructor of the PdfDocumentSource class

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);
}
Workaround: provide an implementation of PdfImportSettings with CopyStream set to true:
using (Stream stream = ofd.OpenFile())
{
	PdfImportSettings importSettings = new PdfImportSettings
	{
		CopyStream = true
	};

	this.pdfViewer.DocumentSource = new PdfDocumentSource(stream, importSettings);
}

0 comments