フリーテキスト注釈の追加

Contents
[ ]

フリーテキスト注釈を使用すると、ポップアップコメントを必要とせずに、表示されているテキストをPDFページに直接配置できます。PDFContentEditor を使用すると、注釈の四角形、表示されるテキスト、およびターゲットページを指定できます。

  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_free_text_annotation(infile, outfile):
    # Create PdfContentEditor object
    content_editor = pdf_facades.PdfContentEditor()
    # Bind document to PdfContentEditor
    content_editor.bind_pdf(infile)
    # Add free text annotation to page 1
    content_editor.create_free_text(
        apd.Rectangle(200, 480, 150, 25), "This is a free text annotation", 1
    )
    # Save updated document
    content_editor.save(outfile)