-
Notifications
You must be signed in to change notification settings - Fork 248
Description
Is work very good but only sometimes this happened.
{"Unable to load DLL 'pdfium.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)"}
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146233052
HelpLink: null
InnerException: null
Message: "Unable to load DLL 'pdfium.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)"
Source: "PdfiumViewer"
StackTrace: " at PdfiumViewer.NativeMethods.Imports.FPDF_InitLibrary()\r\n at PdfiumViewer.NativeMethods.FPDF_InitLibrary()\r\n at PdfiumViewer.PdfLibrary..ctor()\r\n at PdfiumViewer.PdfLibrary.EnsureLoaded()\r\n at PdfiumViewer.PdfFile..ctor(Stream stream, String password)\r\n at PdfiumViewer.PdfDocument..ctor(Stream stream, String password)\r\n at PdfiumViewer.PdfDocument.Load(Stream stream, String password)\r\n at PdfiumViewer.PdfDocument.Load(Stream stream)\r\n at
private void OpenPDF(string path)
{
if (!File.Exists(path)) {
return;
}
PictureViewer.Visible = false;
PictureViewer.Dock = DockStyle.None;
PdfViewer.Visible = true;
PdfViewer.Dock = DockStyle.Fill;
byte[] bytes = File.ReadAllBytes(path);
var stream = new MemoryStream(bytes);
try
{
//is work
PdfDocument pdfDocument = PdfDocument.Load(stream);
PdfViewer.Document = pdfDocument;
}
catch (Exception ex)
{
//just sometimes
}
}