Tambahkan Anotasi Kotak

Contents
[ ]

Anotasi kotak biasanya digunakan untuk menyoroti area yang menarik, menandai bagian penting, atau memberikan petunjuk visual dalam dokumen PDF. Menggunakan PdfContentEditor, Anda dapat membuat anotasi kotak (atau bulat) dengan menentukan persegi batas, teks konten, warna batas, opsi isi, nomor halaman, dan lebar batas.

  1. Buat objek PdfContentEditor.
  2. Gabungkan PDF input.
  3. Definisikan anotasi Square.
  4. Tambahkan anotasi Square.
  5. Simpan Document yang diperbarui.
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_square_annotation(infile, outfile):
    # Create PdfContentEditor object
    content_editor = pdf_facades.PdfContentEditor()
    # Bind input PDF file
    content_editor.bind_pdf(infile)

    # Create SquareAnnotation object
    rect = apd.Rectangle(100, 300, 200, 400)
    contents = "This is square annotation"
    content_editor.create_square_circle(rect, contents, apd.Color.blue, True, 1, 3)

    # Save output PDF file
    content_editor.save(outfile)