ポップアップ注釈の追加

Contents
[ ]

ポップアップ注釈は、PDF ファイルにコメント、説明、またはインタラクティブなメモを追加するのに役立ちます。を使用する PDF コンテンツエディター、場所、コンテンツ、表示、ページ番号を指定することで、ポップアップ注釈をプログラムで作成できます。

  1. PDF コンテンツエディターオブジェクトを作成します。
  2. 入力 PDF をバインドします。
  3. ポップアップ注釈の四角形を定義します。
  4. ポップアップ注釈を追加します。
  5. 更新したドキュメントを保存します。
import aspose.pdf as ap
import aspose.pdf.facades as pdf_facades
import aspose.pydrawing as apd
import sys
from os import path

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

from config import set_license, initialize_data_dir


def add_popup_annotation(infile, outfile):
    # Create PdfContentEditor object
    content_editor = pdf_facades.PdfContentEditor()
    # Bind document to PdfContentEditor
    content_editor.bind_pdf(infile)
    # Add popup annotation to page 1
    content_editor.create_popup(
        apd.Rectangle(220, 520, 180, 80),
        "This is a popup annotation",
        True,
        1,
    )
    # Save updated document
    content_editor.save(outfile)