주석
from ironpdf import *

# Load an existing PDF or create a new one
pdf = PdfDocument("existing.pdf")

pageIndex = 0

# Create a TextAnnotation object
annotation = TextAnnotation(pageIndex)
annotation.Title = "This is the major title"
annotation.Subject = "This is a subtitle"
annotation.Contents = "This is the long 'sticky note' comment content..."
annotation.Icon = TextAnnotation.AnnotationIcon.Help
annotation.X = 150
annotation.Y = 200
annotation.Width = 200
annotation.Height = 50
annotation.Opacity = 0.9
annotation.Printable = False
annotation.Hidden = False
annotation.OpenByDefault = True
annotation.ReadOnly = False
annotation.Rotatable = True

# Add the annotation to a specific page and location within the PDF
pdf.Annotations.Add(annotation)

# Save the PDF
pdf.SaveAs("existing.pdf")
pip install ironpdf
주석

주석

IronPDF for Python은 PDF 문서에 인터랙티브 텍스트 주석 - 흔히 스티키 노트라고 불리는 - 을 추가하여 특정 위치에 댓글, 검토 노트, 메타데이터를 첨부할 수 있습니다.

시작하기

문서를 로드하거나 PdfDocument, 대상 페이지 인덱스로 TextAnnotation을 인스턴스화하고, 그 속성을 구성하고, 문서의 Annotations 컬렉션에 추가한 후 저장하십시오.

코드 이해하기

  • TextAnnotation(pageIndex): 지정된 0 기반 페이지 인덱스를 대상으로 하는 새 주석을 생성합니다.
  • Title: 주석 팝업의 주요 제목 텍스트입니다.
  • Subject: 주석을 위한 부제목 또는 보조 제목입니다.
  • Contents: 주석의 본문 텍스트 - 주요 댓글이나 노트 컨텐츠입니다.
  • Icon: 페이지에 표시되는 시각적 아이콘입니다. 옵션에는 Help, Note, Comment, Key와 TextAnnotation.AnnotationIcon의 다른 옵션 등이 포함됩니다.
  • X / Y: 페이지에서 주석 앵커 포인트의 위치, 포인트 단위입니다.
  • Width / Height: 주석 팝업 상자의 치수입니다.
  • Opacity: 주석의 투명도를 0.0에서 1.0까지 조절하는 값입니다.
  • Printable: False일 때, 주석은 인쇄된 출력물에 포함되지 않습니다.
  • Hidden: False일 때, 주석은 PDF 뷰어에서 보입니다.
  • OpenByDefault: True일 때, PDF가 처음 열릴 때 주석 팝업이 열려 있습니다.
  • ReadOnly: False일 때, 사용자가 PDF 뷰어에서 주석을 편집할 수 있습니다.
  • Rotatable: True일 때, 사용자가 주석을 회전할 수 있습니다.
  • pdf.Annotations.Add(annotation): 구성된 주석을 문서에 추가합니다.

시작할 준비 되셨나요?

버전:2026.11방금 출시