폴리곤 주석 추가

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_polygon_annotation(infile, outfile):
    # Create PdfContentEditor object
    content_editor = pdf_facades.PdfContentEditor()
    # Bind input PDF file
    content_editor.bind_pdf(infile)

    line_info = pdf_facades.LineInfo()
    line_info.border_style = 0  # 0 - Solid
    line_info.vertice_coordinate = [100, 200, 150, 260, 220, 220, 200, 160]
    content_editor.create_polygon(
        line_info,
        1,
        apd.Rectangle(90, 150, 150, 120),
        "This is polygon annotation",
    )

    # Save output PDF file
    content_editor.save(outfile)