添加圆形注释

Contents
[ ]

圆形注释对于突出 PDF 文档中感兴趣的区域非常有用。使用 PdfContentEditor,您可以通过指定定义圆形边界的矩形以及注释文本、颜色、填充选项、页码和边框宽度来创建圆形形状。

  1. 创建 PdfContentEditor 对象。
  2. 绑定输入 PDF。
  3. 定义圆形边界。
  4. 添加圆形注释。
  5. 保存已更新的 Document。
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_circle_annotation(infile, outfile):
    # Create PdfContentEditor object
    content_editor = pdf_facades.PdfContentEditor()
    # Bind input PDF file
    content_editor.bind_pdf(infile)

    # Create CircleAnnotation object
    rect = apd.Rectangle(300, 300, 400, 400)
    contents = "This is circle annotation"
    content_editor.create_square_circle(rect, contents, apd.Color.blue, False, 1, 3)

    # Save output PDF file
    content_editor.save(outfile)