IronPDF 开始 使用IronPdfEngine How to Use IronPdfEngine Curtis Chau 已更新:六月 1, 2025 Download IronPDF npm 下载 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English IronPdfEngine 是一个 gRPC 服务器,专为监督一系列 IronPDF 任务而设计,涵盖了 PDF 文档的创建、编辑和读取。 class="hsg-featured-snippet"> 如何在 Node.js 中使用 IronPdfEngine 安装 Node.js 库以使用 IronPdfEngine。 通过 npm 安装该库。 通过相同的安装获取 Chrome 二进制文件。 通过访问 `ironPdfEngineVersion` 属性检查所需的版本。 使用 IronPdfEngine 以与 Chrome 相同的渲染器将 HTML 渲染为 PDF。 开始使用 IronPDF IronPdf Node.js 和 IronPdfEngine IronPdf for Node.js 需要 IronPdfEngine 才能运行。 Node.js 代码只是 IronPdfEngine gRPC 上的一个 API 掩码。 所以,当您调用 Node.js 中的任何 IronPdf 方法时,魔法就在 IronPdfEngine 内部发生! 默认情况下,IronPdf for Node.js 将作为子进程生成 IronPdfEngine,并与其通信,直到您的应用程序关闭。 注意:每个版本的 IronPdf for Node.js 需要特定版本的 IronPdfEngine。不支持交叉版本。 本地 IronPdfEngine 的 Node.js IronPdf 选项 1:在运行时下载 IronPdfEngine 默认情况下,安装 IronPdf 后,在 JavaScript 项目中首次运行时,IronPdf 将检测您的平台(例如 Windows x64)并从互联网上下载正确的 IronPdfEngine 二进制文件。 npm install @ironsoftware/ironpdf npm install @ironsoftware/ironpdf SHELL 优点: 您的申请包将很小。 可在多种平台上部署。 缺点: 需要在最初几次运行时访问互联网。 启动时间慢。 选项 2(推荐):将 IronPdfEngine 安装为依赖项 IronPdf for Node.js 允许您将 IronPdfEngine 添加为依赖项。 这些 IronPdfEngine 依赖项将 IronPdfEngine 捆绑到一个 .zip 文件中,并将自动解压并使用它。 您可以选择安装一个或多个这些 IronPdfEngine 依赖项。 注意:ironpdf 和 ironpdf-engine-xxx-xxx 依赖项版本必须相同。 ironpdf-engine-xxx-xxx 依赖项版本不指 IronPdfEngine 的内部版本。 平台特定安装: Windows x64: npm install @ironsoftware/ironpdf-engine-windows-x64 npm install @ironsoftware/ironpdf-engine-windows-x64 SHELL Windows x86: npm install @ironsoftware/ironpdf-engine-windows-x86 npm install @ironsoftware/ironpdf-engine-windows-x86 SHELL Linux x64: npm install @ironsoftware/ironpdf-engine-linux-x64 npm install @ironsoftware/ironpdf-engine-linux-x64 SHELL macOS x64: npm install @ironsoftware/ironpdf-engine-macos-x64 npm install @ironsoftware/ironpdf-engine-macos-x64 SHELL macOS arm: npm install @ironsoftware/ironpdf-engine-macos-arm64 npm install @ironsoftware/ironpdf-engine-macos-arm64 SHELL 优点: 更快的启动时间。 安装依赖项后无需访问互联网。 缺点: 您的申请文件包将很大。 需要指定目标平台。 带有远程 IronPdfEngine 的 Node.js IronPdf 要使用远程 IronPdfEngine,需要特定版本的 IronPdfEngine。 例如,如果 Node.js 版 IronPdf 2024.2.2 需要 IronPdfEngine 版 2024.2.2,请勿使用 IronPdfEngine 版 2024.2.1。访问 ironPdfEngineVersion 属性以检查所需版本。 const ironPdfEngineVersion = IronPdfGlobalConfig.ironPdfEngineVersion; const ironPdfEngineVersion = IronPdfGlobalConfig.ironPdfEngineVersion; JAVASCRIPT 如何连接 假设 IronPdfEngine 远程运行在 123.456.7.8:33350。 参考"如何拉取和运行 IronPdfEngine"。 要连接,您只需指定 IronPdfEngine 的位置(确保地址可访问,没有被防火墙阻止)。 在应用程序的初始阶段或在调用任何 IronPdf 方法之前添加此代码。 IronPdfGlobalConfig.setConfig({ ironPdfEngineDockerAddress: "123.456.7.8:33350" }); IronPdfGlobalConfig.setConfig({ ironPdfEngineDockerAddress: "123.456.7.8:33350" }); JAVASCRIPT 就这么简单! 这样之后,您的应用程序将连接到远程 IronPdfEngine! 对于远程 IronPdfEngine,无需将 IronPdfEngine 作为依赖项进行安装。 您可以跳过标题为"选项 2(推荐)将 IronPdfEngine 安装为依赖项"的部分。 常见问题解答 IronPdfEngine在Node.js中用于什么? IronPdfEngine是Node.js中的一个gRPC服务器,用于管理创建、编辑和渲染PDF任务,提供无缝的PDF处理体验。 如何安装IronPDF for Node.js? 你可以使用npm通过命令 npm install @ironsoftware/ironpdf 安装IronPDF for Node.js。 IronPdfEngine的本地和远程设置之间有什么差异? 本地设置涉及在运行时下载IronPdfEngine或将其作为依赖项安装,从而提供更快的启动时间。远程设置连接到一个远程托管的IronPdfEngine,从而无需本地安装。 如何确保IronPdf和IronPdfEngine版本之间的兼容性? 每个版本的IronPdf for Node.js都需要特定版本的IronPdfEngine。使用 ironPdfEngineVersion 属性检查所需版本,并确保两个版本匹配。 将IronPdfEngine作为依赖项安装有什么好处? 将IronPdfEngine作为依赖项安装可导致更快的启动时间,并在安装后无需访问互联网,尽管这会增加应用程序包的大小。 我如何连接到远程IronPdfEngine? 要连接到远程IronPdfEngine,使用 IronPdfGlobalConfig.setConfig 指定服务器地址,确保其可访问且未被防火墙阻止。 IronPdfEngine的运行时下载是否需要互联网访问? 是的,在运行时下载IronPdfEngine时,首次需要联网访问,这也会导致启动时间较慢。 我需要为远程使用安装IronPdfEngine吗? 不,当使用远程IronPdfEngine时,你不需要在本地将其作为依赖项安装。 IronPdfEngine可以在不同的平台上使用吗? 是的,IronPdfEngine可以部署在多个平台上。平台特定的npm命令可用于在Windows、Linux和macOS上进行安装。 IronPDF 是否兼容 .NET 10?它支持哪些环境? 是的,IronPDF 完全兼容 .NET 10(以及 .NET 9、8、7 等)。它支持 C#、VB.NET 和 F#,并且可以在 Windows、Linux、macOS 等平台上运行,包括 Docker 和云环境,因此适用于 .NET 10 的 Web、桌面、控制台或云项目。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? 版本: 2025.11 刚刚发布 免费npm安装 查看许可证