How to Pull and Run IronPdfEngine

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

调用和运行 IronPdfEngine 映像涉及从 Dockerhub、AWS ECR Public Gallery 或 AWS Marketplace 获取预构建的容器映像,然后在 Docker 环境中执行它。

拉取:这是指从指定注册表中检索 IronPdfEngine 容器映像 (Dockerhub、AWS ECR 公共图库或 AWS Marketplace) 到本地系统中。为此,通常会使用 docker pull 命令。

运行:提取映像后,使用 docker run 命令根据映像启动一个容器实例。这将在 Docker 容器中启动 IronPdfEngine 应用程序,让你可以使用它的功能。

适用于PDF的C# NuGet库

安装使用 NuGet

Install-Package IronPdf
Java PDF JAR

下载 DLL

下载DLL

手动安装到你的项目中

适用于PDF的C# NuGet库

安装使用 NuGet

Install-Package IronPdf
Java PDF JAR

下载 DLL

下载DLL

手动安装到你的项目中

开始在您的项目中使用IronPDF,并立即获取免费试用。

第一步:
green arrow pointer

查看 IronPDFNuget 用于快速安装和部署。它有超过800万次下载,正在使用C#改变PDF。

适用于PDF的C# NuGet库 nuget.org/packages/IronPdf/
Install-Package IronPdf

考虑安装 IronPDF DLL 直接。下载并手动安装到您的项目或GAC表单中: IronPdf.zip

手动安装到你的项目中

下载DLL

在 Dockerhub 中获取 IronPdfEngine

前提条件

  • 必须安装 Docker。

设置

1.转至 https://hub.docker.com/r/ironsoftwareofficial/ironpdfengine

2.提取 ironsoftwareofficial/ironpdfengine 映像

docker pull ironsoftwareofficial/ironpdfengine

或调出特定版本 (推荐)

docker pull ironsoftwareofficial/ironpdfengine:2023.12.6

3.运行 ironsoftwareofficial/ironpdfengine 容器。

此命令将创建一个容器并在后台运行,端口为 33350

docker run -d -p 33350:33350 ironsoftwareofficial/ironpdfengine

浏览" "部分,了解如何配置 IronPdf 客户端以使用 IronPdfEngine。更新代码以使用 IronPdfEngine."


IronPdfEngine inside Docker compose

关键是要建立一个 Docker 网络,让 IronPdfEngine 和你的应用程序能互相看到对方。设置 "lepend_on",确保 IronPdfEngine 在你的应用程序启动前就已运行。

设置

1.首先创建一个 docker-compose.yml 文件。使用以下模板设置 Docker Compose 文件:

version: "3.6"
services:
  myironpdfengine:
    container_name: ironpdfengine
    image: ironsoftwareofficial/ironpdfengine:latest
    ports:
      - "33350:33350"
    networks:
      - ironpdf-network
  myconsoleapp:
    container_name: myconsoleapp
    build:
      # enter YOUR project directory path here
      context: ./MyConsoleApp/
      # enter YOUR dockerfile name here, relative to project directory
      dockerfile: Dockerfile
    networks:
      - ironpdf-network
    depends_on:
      myironpdfengine:
        condition: service_started
networks:
  ironpdf-network: 
    driver: "bridge"

2.在应用程序中设置 IronPdfEngine 的地址 (我的控制台应用程序) 到 "myironpdfengine:33350"

3.运行 docker compose

docker compose up --detach --force-recreate --remove-orphans --timestamps

在 AWS ECR 公共图库中获取 IronPdfEngine

前提条件

  • 必须安装 Docker。

设置

1.转至 https://gallery.ecr.aws/v1m9w8y1/ironpdfengine

2.提取 v1m9w8y1/ironpdfengine 映像

docker pull https://gallery.ecr.aws/v1m9w8y1/ironpdfengine

或调出特定版本 (推荐)

docker pull https://gallery.ecr.aws/v1m9w8y1/ironpdfengine:2023.12.6

3.运行 ironpdfengine 容器。

此命令将创建一个容器并在后台运行,端口为 33350

docker run -d -p 33350:33350 ironsoftwareofficial/ironpdfengine

浏览" "部分,了解如何配置 IronPdf 客户端以使用 IronPdfEngine。更新代码以使用 IronPdfEngine."


在 AWS Marketplace 获取 IronPdfEngine

aws 市场

先决条件

  • 必须安装 Docker。
  • 必须安装并登录 AWS CLI。

设置

1.转到 AWS 市场上的 IronPdfEngine.点击 "继续订阅"。

3.接受条款。

接受 EULA
  1. 继续前往 Confiuguration。
完整订阅
  1. 提取 ironpdfengine 映像。这一步将向你展示调用 ironpdfengine 映像的命令。
启动该软件

例如

aws ecr get-login-password \
    --region us-east-1 
 docker login \
    --username AWS \
    --password-stdin 000000000000.dkr.ecr.us-east-1.amazonaws.com
CONTAINER_IMAGES="000000000000.dkr.ecr.us-east-1.amazonaws.com/iron-software/ironpdfengine:2024.1.15"    
for i in $(echo $CONTAINER_IMAGES 
 sed "s/,/ /g"); do docker pull $i; done
  1. 运行 ironpdfengine 容器。此命令将创建一个容器,并在后台以 33350 端口运行。
docker run -d -p 33350:33350 000000000000.dkr.ecr.us-east-1.amazonaws.com/iron-software/ironpdfengine:2024.1.15

从 Azure Marketplace 获取 IronPdfEngine

Azure 市场

设置

1.转到 Azure Marketplace 上的 IronPDF Docker 容器.点击 "立即获取 "和 "继续"。

2.完成 "基础知识"、"群集详情 "和 "应用程序详情",创建 Kubernetes 服务。

3.部署完成后,在左侧边栏进入 Kubernetes 资源 -> 运行命令。运行以下命令

kubectl get services
Kubernetes 服务 - 运行命令

使用 EXTERNAL-IP 和 PORT 信息(S)您可以对 IronPDFEngine 连接进行相应配置。

:path=/static-assets/pdf/content-code-examples/how-to/pull-run-ironpdfengine-azure-marketplace.cs
using IronPdf;
using IronPdf.GrpcLayer;

IronPdf.License.LicenseKey = "IRONPDF-MYLICENSE-KEY-1EF01";

IronPdfConnectionConfiguration configuration = new IronPdfConnectionConfiguration();
configuration.ConnectionType = IronPdfConnectionType.RemoteServer;
configuration.Host = "http://48.216.143.233";
configuration.Port = 80;
IronPdf.Installation.ConnectToIronPdfHost(configuration);

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>testing</h1>");
pdf.SaveAs("output.pdf");
Imports IronPdf
Imports IronPdf.GrpcLayer

IronPdf.License.LicenseKey = "IRONPDF-MYLICENSE-KEY-1EF01"

Dim configuration As New IronPdfConnectionConfiguration()
configuration.ConnectionType = IronPdfConnectionType.RemoteServer
configuration.Host = "http://48.216.143.233"
configuration.Port = 80
IronPdf.Installation.ConnectToIronPdfHost(configuration)

Dim renderer As New ChromePdfRenderer()
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>testing</h1>")
pdf.SaveAs("output.pdf")
VB   C#

更新代码以使用 IronPdfEngine

这需要修改代码,确保 IronPdf 指向 IronPdfEngine 公开的正确端口。每种编程语言的操作略有不同。具体使用说明请参阅以下文章:

此外,你还可以在任何地方部署这个容器。只要别忘了暴露 33350 端口,并让 IronPdf 客户端可以访问它。要了解有关 IronPdfEngine 及其限制的更多信息,请访问 "什么是 IronPdfEngine?"一文。