スタンプを ID で移動
Contents
[
Hide
]
PDF にラバースタンプの注釈を追加した後、その位置を調整する必要がある場合があります。‘move_stamp_by_id () ‘メソッドを使用すると、スタンプを再作成しなくても、識別子に基づいてスタンプを再配置できます。これは、スタンプの配置を動的に調整する必要がある自動ワークフローで役立ちます。
- を作成 PDF コンテンツエディター インスタンス。
- 入力 PDF ドキュメントをバインドします。
- ラバースタンプの注釈を追加します。
- ID を使用してスタンプを移動します。
- 更新した 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 move_stamp_by_id_example(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind document to PdfContentEditor
content_editor.bind_pdf(infile)
content_editor.create_rubber_stamp(
1,
apd.Rectangle(300, 420, 180, 60),
"Approved",
"Move this stamp by ID",
apd.Color.green,
)
# Move stamp by ID overload
content_editor.move_stamp_by_id(1, 1, 240, 360)
# Save updated document
content_editor.save(outfile)