如何使用 IronPdfEngine

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

IronPdfEngine 是一個 gRPC 伺服器,旨在管理一系列IronPDF任務,包括建立、編輯和讀取 PDF 文件。

立即開始在您的項目中使用 IronPDF 並免費試用。

第一步:
green arrow pointer


IronPDF for Python 和 IronPdfEngine

IronPDF for Python不需要IronPdfEngine 即可運作。 IronPdfEngine 只是使用IronPDF 的一種可選方式。 預設情況下,Python 版IronPDF不會使用 IronPdfEngine。

請注意注意:每個版本的IronPDF for Python 都需要特定版本的 IronPdfEngine。不支援跨版本使用。 對於 Python 版IronPDF ,所需的 IronPdfEngine 版本始終相符。 例如, IronPDF 2024.2.2 將使用 IronPdfEngine 2024.2.2。

適用於 Python 的IronPDF和遠端 IronPdfEngine

假設 IronPdfEngine 在遠端 123.456.7.8:33350 運行。

請注意注意:若要遠端執行 IronPdfEngine,請參閱"如何拉取和執行 IronPdfEngine "。

使用 pip 安裝IronPDF

使用以下命令安裝IronPDF:

 pip install ironpdf

安裝IronPDF後,您需要告知IronPDF IronPdfEngine 的位置。 請確保該位址可存取且未被防火牆封鎖。 使用 IronPdfConnectionConfiguration 類別配置連線設定。 在應用程式開始時,或在呼叫任何IronPDF方法之前,請新增此配置程式碼。

# Import necessary modules
from ironpdf import Installation, IronPdf

# Configure the connection settings to connect to the remote IronPdfEngine
Installation.ConnectToIronPdfHost(
    IronPdf.GrpcLayer.IronPdfConnectionConfiguration.RemoteServer("123.456.7.8:33350")
)
# Import necessary modules
from ironpdf import Installation, IronPdf

# Configure the connection settings to connect to the remote IronPdfEngine
Installation.ConnectToIronPdfHost(
    IronPdf.GrpcLayer.IronPdfConnectionConfiguration.RemoteServer("123.456.7.8:33350")
)
PYTHON

就這麼簡單! 之後,您的應用程式將連接到遠端 IronPdfEngine!

常見問題解答

如何将 IronPDFEngine 用作远程服务器?

要将 IronPDFEngine 用作远程服务器,首先安装 Python 庫和来自 PyPi 的 IronPDF 包。然後,使用 IronPDFConnectionConfiguration 类配置连接,并使用 IronPDFEngine 提供的类 Chrome 渲染器将 HTML 渲染為 PDF。

在 Python 中運行 PDF 任务是否需要 IronPDFEngine?

不,在 Python 中運行 PDF 任务不需要使用 IronPDFEngine。IronPDF for Python 可以独立運行,不需要 IronPDFEngine,这仅用于远程操作。

如何在 Python 中安装 IronPDF?

您可以使用 pip 和以下命令在 Python 中安装 IronPDF:pip install ironpdf

连接到远程 IronPDFEngine 需要哪些配置?

要连接到远程 IronPDFEngine,使用 IronPDFConnectionConfiguration.RemoteServer 方法指定服务器地址,确保服务器可访問且未被防火墙阻止。

不同版本的 IronPDF 和 IronPDFEngine 可以一起使用嗎?

不,不支持使用不同版本的 IronPDF 和 IronPDFEngine。每個版本的 IronPDF for Python 需要特定匹配版本的 IronPDFEngine。

如何确保 IronPDF for Python 和 IronPDFEngine 之间的兼容性?

通過使用相同版本的 IronPDF for Python 和 IronPDFEngine 来确保兼容性。例如,IronPDF 2024.2.2 應与 IronPDFEngine 2024.2.2 一起使用。

IronPDF for Python 关于远程连接的默認行為是什么?

默認情况下,IronPDF for Python 不会连接到 IronPDFEngine。它独立操作,除非配置连接到使用 IronPDFEngine 的远程服务器。

如何使用 IronPDFEngine 远程渲染 HTML 為 PDF?

設置好与 IronPDFConnectionConfiguration 类的连接後,可以使用 IronPDFEngine 的类 Chrome 渲染器来远程渲染 HTML 為 PDF。

在哪里可以找到有关設置远程 IronPDFEngine 的更多信息?

有关远程運行 IronPDFEngine 详细说明,请参考“如何拉取并運行 IronPDFEngine”指南。

IronPDFEngine(或 IronPDF)是否支援 .NET 10?

是的。 IronPDF 的 .NET 程式庫與 .NET 10 完全相容,支援 .NET 10、9、8 及更早版本。這確保了使用 .NET 10 的開發人員可以像在先前的 .NET 版本中一樣無縫地使用 IronPDF,包括所有 HTML 到 PDF 的渲染、遠端伺服器連接、版本匹配和引擎使用。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
版本: 2026.3 剛剛發布
Still Scrolling Icon

還在捲動嗎?

想要快速證明?
執行範例 觀看您的 HTML 變成 PDF。