Hosting on Linux

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

IronSecureDoc is a Docker container designed to give you powerful PDF manipulation behind a simple REST API, without the hassle and overhead of online SaaS services. This guide will walk you through the steps to host IronSecureDoc on your machine, including setting up environment variables and a basic example of using the REST API. For the full API, view our REST API Reference.

docker pull ironsoftwareofficial/ironsecuredoc:latest
docker pull ironsoftwareofficial/ironsecuredoc:latest
SHELL

Prerequisites

警告Docker Desktop on Linux runs a Virtual Machine (VM) which creates and uses a custom docker context, desktop-linux, on startup.

This means images and containers deployed on the Linux Docker Engine (before installation) are not available in Docker Desktop for Linux.

Platforms

Step-by-Step Guide

1. Install Docker Desktop

If you haven't already installed Docker Desktop, follow these steps:

  1. Go to the Docker Desktop download page.
  2. Download the Docker Desktop installer for Linux.
  3. Run the installer and follow the on-screen instructions.
  4. After installation, start Docker Desktop and make sure it's running.

2. Pull the "IronSecureDoc" Docker Image

Open a command prompt and pull the latest IronSecureDoc image from Docker Hub:

docker pull ironsoftwareofficial/ironsecuredoc:latest
docker pull ironsoftwareofficial/ironsecuredoc:latest
SHELL

3. Run the Container Without Certificate

Run the Docker container with the necessary environment variables:

Swagger UI in Browser
docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest
SHELL

Apply a Trial or License Key to Remove Watermarks

ヒント Replace <IRONSECUREDOC_LICENSE_KEY> with your actual IronSecureDoc license key. Otherwise, a watermark will be applied on Enterprise Features.

Swagger UI in Browser

4. Access the Container

Once the container is running, you can access IronSecureDoc by opening a web browser and navigating to:

http://localhost:8080/swagger/index.html
Swagger UI in Browser

You should see the IronSecureDoc interface, indicating that your container is running successfully.

5. Run the IronSecureDoc Container With Certificate

If you need to run the container with a certificate, follow these steps to generate the certificate and configure the local machine:

  1. Generate Certificate:

    dotnet dev-certs https -ep $HOME/.aspnet/https/ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER>
    dotnet dev-certs https --trust
    dotnet dev-certs https -ep $HOME/.aspnet/https/ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER>
    dotnet dev-certs https --trust
    SHELL

    Replace <CREDENTIAL_PLACEHOLDER> with a password.

  2. Run the Docker Container:

    docker container run -d -p 8081:8081 -p 8080:8080 \
    -e HTTP_PORTS=8080 -e HTTPS_PORTS=8081 \
    -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> \
    -e ENVIRONMENT=Production \
    -v $HOME/.aspnet/https:/https:ro \
    -e CERTIFICATE_PATH=$HOME/.aspnet/https/ironsecuredoc.pfx \
    -e CERTIFICATE_PASSWORD=<CERTIFICATE_PASSWORD> \
    ironsoftwareofficial/ironsecuredoc:latest
    docker container run -d -p 8081:8081 -p 8080:8080 \
    -e HTTP_PORTS=8080 -e HTTPS_PORTS=8081 \
    -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> \
    -e ENVIRONMENT=Production \
    -v $HOME/.aspnet/https:/https:ro \
    -e CERTIFICATE_PATH=$HOME/.aspnet/https/ironsecuredoc.pfx \
    -e CERTIFICATE_PASSWORD=<CERTIFICATE_PASSWORD> \
    ironsoftwareofficial/ironsecuredoc:latest
    SHELL

    Replace <IRONSECUREDOC_LICENSE_KEY> and <CERTIFICATE_PASSWORD> with your actual IronSecureDoc license key and certificate password, respectively.

6. Managing the Container

You can manage your running container using Docker commands. Here are a few useful commands:

  • Stop the container:

    docker stop <container_id>
    docker stop <container_id>
    SHELL
  • Start the container:

    docker start <container_id>
    docker start <container_id>
    SHELL
  • Remove the container:

    docker rm -f <container_id>
    docker rm -f <container_id>
    SHELL

Replace <container_id> with the actual container ID or name.

Environment Variables

The container can be configured using the following environment variables:

  • PDF_MAX_SIZE_MB (Default: 30): Sets the maximum allowed file size for PDF uploads in Megabytes.
  • REQUEST_TIMEOUT_SECONDS (Default: 5): Sets the timeout duration in seconds for API requests. A value of -1 allows requests to run indefinitely.
  • ALLOWED_ORIGINS: Configures Cross-Origin Resource Sharing (CORS) by specifying allowed origin URLs. Separate multiple URLs with commas. Use * or "all" to allow requests from any origin.
  • HTTP_PORTS: Defines the HTTP ports the container exposes. This should match the port mapping using the -p flag (e.g., 8080). Separate multiple ports with a semicolon (;).
  • HTTPS_PORTS: Defines the HTTPS ports the container exposes. This should match the port mapping using the -p flag (e.g., 8081). Separate multiple ports with a semicolon (;).
  • IronSecureDoc_LicenseKey (Required): Sets the IronSecureDoc license key. Important: Do not share this value publicly.

Basic Example: Redact Text in a Document

For the full list of API endpoints, refer to the full REST API Reference.

Redact Text

curl -X POST 'http://localhost:8080/v1/document-services/pdfs/redact-text' \
   -H 'accept: */*' \
   -H 'Content-Type: multipart/form-data' \
   -F 'pdf_file=@/path/to/your/document.pdf;type=application/pdf' \
   -F 'words_to_redact="sensitiveWord"' \
   -F 'draw_black_box=true' \
   -F 'match_whole_word=true' \
   -F 'match_case=true'
curl -X POST 'http://localhost:8080/v1/document-services/pdfs/redact-text' \
   -H 'accept: */*' \
   -H 'Content-Type: multipart/form-data' \
   -F 'pdf_file=@/path/to/your/document.pdf;type=application/pdf' \
   -F 'words_to_redact="sensitiveWord"' \
   -F 'draw_black_box=true' \
   -F 'match_whole_word=true' \
   -F 'match_case=true'
SHELL

Replace /path/to/your/document.pdf with the actual path to the document you want to redact and sensitiveWord with the word you want to redact.

Redact Regular Expression

curl -X POST 'http://localhost:8080/v1/document-services/pdfs/redact-regular-expression' \
   -H 'accept: */*' \
   -H 'Content-Type: multipart/form-data' \
   -F 'pdf_file=@/path/to/your/document.pdf;type=application/pdf' \
   -F 'regular_expression="[0-9]"' \
   -F 'draw_black_box=true'
curl -X POST 'http://localhost:8080/v1/document-services/pdfs/redact-regular-expression' \
   -H 'accept: */*' \
   -H 'Content-Type: multipart/form-data' \
   -F 'pdf_file=@/path/to/your/document.pdf;type=application/pdf' \
   -F 'regular_expression="[0-9]"' \
   -F 'draw_black_box=true'
SHELL

Replace /path/to/your/document.pdf with the actual path to the document you want to redact and [0-9] with the regular expression you want to match and redact.

Conclusion

You have successfully hosted IronSecureDoc on your machine and configured it with necessary environment variables. You also learned how to interact with the IronSecureDoc REST API using cURL for both basic and advanced operations. For further configuration and usage details, refer to the full REST API Reference.

よくある質問

IronSecureDocとは何か、その機能は?

IronSecureDocは、REST APIを介して強力なPDF操作を提供し、SaaSサービスに依存せずにオフラインのドキュメントセキュリティを可能にするDockerコンテナです。

LinuxサーバーでIronSecureDocを設定するための要件は何ですか?

LinuxサーバーでIronSecureDocを設定するには、Ubuntu, Debian, Fedora, Red Hat Enterprise LinuxなどのLinuxディストリビューションにDocker Desktopがインストールされていることを確認してください。

IronSecureDocのDockerイメージをダウンロードする方法は?

ターミナルで次のコマンドを実行することでIronSecureDocのDockerイメージをダウンロードします: docker pull ironsoftwareofficial/ironsecuredoc:latest

SSL証明書なしでIronSecureDocコンテナを実行することは可能ですか?

はい、次のコマンドを使用することでSSL証明書なしでコンテナを実行できます: docker container run --rm -p 8080:8080 -e IronSecureDoc_LicenseKey= -e ENVIRONMENT=Development -e HTTP_PORTS=8080 ironsoftwareofficial/ironsecuredoc:latest

どうやってブラウザでIronSecureDocインターフェースにアクセスできますか?

コンテナを起動後、Webブラウザーでhttp://localhost:8080/swagger/index.htmlを訪れることでIronSecureDocインターフェースにアクセスします。

IronSecureDocのSSL証明書を生成して信頼する方法は?

次を使用してSSL証明書を生成します: dotnet dev-certs https -ep $HOME/.aspnet/https/ironsecuredoc.pfx -p そして次を使用して信頼します: dotnet dev-certs https --trust

IronSecureDocで設定可能な環境変数は何ですか?

IronSecureDocで設定可能な環境変数にはPDF_MAX_SIZE_MB, REQUEST_TIMEOUT_SECONDS, ALLOWED_ORIGINS, HTTP_PORTS, HTTPS_PORTS, IronSecureDoc_LicenseKeyがあります。

IronSecureDoc を使用して PDF 内のテキストをどのようにレダクトしますか?

必要なフォームデータとともに次のcURLコマンドを使用してPDF内のテキストを編集します: curl -X POST 'http://localhost:8080/v1/document-services/pdfs/redact-text'

実行中のIronSecureDoc Dockerコンテナを停止するコマンドは何ですか?

次のコマンドを使用して実行中のDockerコンテナを停止します: docker stop

IronSecureDocの完全なAPIエンドポイントのリストはどこにありますか?

完全なAPIエンドポイントのリストは、IronSecureDocウェブサイトのREST APIリファレンスにあります。

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はいいですか?
バージョン: 2024.10 ただ今リリースされました