当前位置: 首页 > article >正文

C# - 无法加载 DLL“libmupdf.dll”: 找不到指定的模块。

1.本机环境

  • windows 11 64位
  • Visual Studio 2015

2.报错如下

用户代码未处理 System.DllNotFoundException
HResult=-2146233052
Message=无法加载 DLL“libmupdf.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)Source=MoonPdfLib
TypeName=""
StackTrace:
在 MoonPdfLib.MuPdf.MuPdfWrapper.NativeMethods.NewContext(IntPtr alloc, IntPtr locks, UInt32 max_store)
在 MoonPdfLib.MuPdf.MuPdfWrapper.PdfFileStream..ctor(IPdfSource source)
在 MoonPdfLib.MuPdf.MuPdfWrapper.GetPageBounds(IPdfSource source, ImageRotation rotation, String password)
在 MoonPdfLib.MoonPdfPanel.LoadPdf(IPdfSource source, String password)
在 MoonPdfLib.MoonPdfPanel.Open(IPdfSource source, String password)
在 MoonPdfLib.MoonPdfPanel.OpenFile(String pdfFilename, String password)
在 JD.EngineerTool.Pages.ReportSet.Controls.ReportJXTools.Button_Click(Object sender, RoutedEventArgs e) 位置 I:\vs2015\2024.11.15NewZiZhu\工程师端\JD.EngineerTool\Pages\ReportSet\Controls\ReportJXTools.xaml.cs:行号 60
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
在 System.Windows.Controls.Primitives.ButtonBase.OnClick()
在 System.Windows.Controls.Button.OnClick()
在 System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
在 System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
在 System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
在 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
在 System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object arg

3.问题描述

程序在运行时未能加载指定的 DLL 文件 libmupdf.dll,导致了 MoonPdfLib 类库无法正常工作。

4.解决方案

Visual Studio 2015 在 NuGet 包管理器中安装 “MoonPdfLib” 程序包。

  1. 顶部菜单栏选择 “工具” 选项
  2. 选择 “NuGet程序包管理器” 选项
  3. 搜索 “ MoonPdfLib ”
  4. 点击安装

在这里插入图片描述
顺利解决本机问题

5.其他情况

 1. 缺少 DLL 文件 
 	libmupdf.dll 可能在你的系统上不存在,或者它没有放在程序可以访问到的正确位置。确保 DLL  文件存在并且可以被加载。
    
    解决方法:
    确保 libmupdf.dll 文件位于与可执行文件相同的目录下,或者已经被添加到系统的环境变量路径中。 
    如果 libmupdf.dll 是外部依赖库,确保你已经安装或下载了该文件。
    
 2. 平台架构不匹配 
 	你可能正在使用与 libmupdf.dll 不兼容的架构(例如,使用 64 位应用程序加载 32 位 DLL,或者相反)。确保应用程序和库的位数一致。
    
    如果你的应用是 64 位的,确保你使用的是 64 位的 libmupdf.dll。如果是 32 位的,确保使用的是 32 位的版本。

3.缺少其他依赖的 DLL
 	libmupdf.dll 可能依赖于其他 DLL 文件,如果这些依赖项没有正确安装,加载时也可能会失败。你可以尝试使用工具(如 Dependency Walker 或者 Process Monitor)检查 libmupdf.dll 是否依赖于其他缺失的库。

 4. 权限问题 
 	如果你的程序没有足够的权限加载 DLL 文件,可能会出现该异常。检查文件权限,确保应用程序有权限读取并加载 libmupdf.dll 文件。

http://www.kler.cn/a/402793.html

相关文章:

  • 【青牛科技】 GC1288:散热风扇领域中 LA6588 / 三洋的理想替代者
  • React中事件绑定和Vue有什么区别?
  • 【金融风控项目-06】:风控建模流程
  • 论文分享 | FuzzLLM:一种用于发现大语言模型中越狱漏洞的通用模糊测试框架
  • <QNAP 453D QTS-5.x> 日志记录:在 Docker 中运行的 Flask 应用安装 自签名 SSL 证书 解决 Chrome 等浏览器证书安全
  • Django实现智能问答助手-基础配置
  • 霸王茶姬小程序自动签到和积分查询任务脚本
  • 利用Matlab对180*360*50的高维数组进行插值处理
  • 【大数据】-- spark 读取 Maxcompute 优化
  • 【C++】绘制内存管理的地图
  • web服务nginx实验6:nginx发布动态页面的方法
  • golang开源框架:命令行框架cobra
  • 指南: 如何在 MEV 项目中使用 Yul
  • 如何提高代理IP的并发能力
  • GPT promote 论文学术润色提示词
  • 【再谈设计模式】适配器模式 ~接口兼容的桥梁
  • 单条推理转批量推理prompt
  • AI应用中基于okhttp3实现SSE技术的各种解决方案实现
  • MySQL排序与分页
  • kali打开复制粘贴功能