Closed Shenyz163 closed 7 years ago
The reason for this is that the PDF file is still in use. PdfiumViewer by default does not load the whole PDF file into memory to keep memory usage as low as possible. Instead, data is streamed into the control as necessary.
There are a few solutions to this I can think of:
Dispose()
the PdfDocument
as this is not done automatically;pdfViewer1.Document = PdfDocument.Load(new MemoryStream(File.ReadAllBytes(form.FileName)));
I can`t delete the pdf file after load in the pdfviewer. (this file is being used by another process).