外観ファイルを使用してラバースタンプを作成

Contents
[ ]

ラバースタンプの注釈は、テキストだけでなく、画像ファイルを外観として使用してカスタマイズすることもできます。この方法は、PDF ページに会社のロゴ、署名スタンプ、その他の視覚的表示を追加する場合に便利です。

  1. を作成 PDF コンテンツエディター インスタンス。
  2. 入力 PDF ドキュメントをバインドします。
  3. スタンプの長方形を定義します。
  4. カスタムイメージファイルを使用して、ラバースタンプの外観を定義します。
  5. スタンプのテキストと色を設定します。
  6. 更新した PDF ドキュメントを保存します。
import aspose.pdf.facades as pdf_facades
import aspose.pydrawing as apd
from io import BytesIO
import sys
from os import path

sys.path.append(path.join(path.dirname(__file__), ".."))

from config import set_license, initialize_data_dir


def create_rubber_stamp_with_appearance_file(infile, image_file, outfile):
    # Create PdfContentEditor object
    content_editor = pdf_facades.PdfContentEditor()
    # Bind document to PdfContentEditor
    content_editor.bind_pdf(infile)
    # Create rubber stamp using appearance_file overload (image path)
    content_editor.create_rubber_stamp(
        1,
        apd.Rectangle(100, 400, 200, 60),
        "Stamp with custom appearance",
        apd.Color.dark_green,
        image_file,
    )
    # Save updated document
    content_editor.save(outfile)