解决 PDFium 依赖项错误

This article was translated from English: Does it need improvement?
Translated
View the article in English

Google PDFium 是 IronPDF 核心代码的重要组成部分,用于实现与 PDF 编辑以及 PDF 文档转换为图像相关的各种功能。 如果项目文件夹中缺少 PDFium 二进制文件,运行时将抛出以下错误。

Unhandled exception. IronSoftware.Exceptions.IronSoftwareDeploymentException: Error while deploying Pdfium for IronPdf: 'Unable to locate 'IronPdfInterop'

通常将 IronPdf.Native.PdfModel 包安装到项目中即可解决此问题。

在 Windows 系统上,建议确保目标操作系统已安装 Visual C++ 运行时

如果这样还无法解决问题,该怎么办?

如果问题仍未解决,我们随时为您提供帮助。兼容性是我们的工程团队高度重视的优先事项。 请通过电子邮件提交错误报告至 support@ironsoftware.com./support@ironsoftware.com 所有兼容性问题都将由高级工程师进行严格审查。

请务必告知我们目标部署的操作系统/平台,尤其是当目标平台为 AWS 或 Azure 等云平台时。

如何在 IronPDF 中启用原生日志记录

在错误报告中附上日志文件,能使我们成功定位问题并快速解决的概率翻倍以上。

请将此代码置于程序开头,在调用任何 IronPDF 方法之前(适用于 2021.3.1 之后的所有版本)。

// Enable debugging to generate detailed log files for troubleshooting.
IronPdf.Logging.Logger.EnableDebugging = true;

// Set the path for the log file. You can specify a directory name or a full file path.
IronPdf.Logging.Logger.LogFilePath = "Default.log";

// Set the logging mode to log all events.
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;
// Enable debugging to generate detailed log files for troubleshooting.
IronPdf.Logging.Logger.EnableDebugging = true;

// Set the path for the log file. You can specify a directory name or a full file path.
IronPdf.Logging.Logger.LogFilePath = "Default.log";

// Set the logging mode to log all events.
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;
' Enable debugging to generate detailed log files for troubleshooting.
IronPdf.Logging.Logger.EnableDebugging = True

' Set the path for the log file. You can specify a directory name or a full file path.
IronPdf.Logging.Logger.LogFilePath = "Default.log"

' Set the logging mode to log all events.
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All
$vbLabelText   $csharpLabel

IronPDF 生成的日志文件位于项目中部署 DLL 的 /bin 目录下:

  • default.log(部署流程)
  • cef.log (渲染)
  • IronSoftwareCefSubprocess.log (渲染与多线程)
  • IronSoftwareEngine.log(适用于调试以"Error generating PDF from..."开头的异常)

云服务器通常会为日志文件指定特定的存储位置。 我们提供了在 AzureAWS 中生成日志文件的指南。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 19,014,616 | 版本: 2026.5 just released
Still Scrolling Icon

还在滚动吗?

想快速获得证据? PM > Install-Package IronPdf
运行示例看着你的HTML代码变成PDF文件。