마크업 주석 추가
Contents
[
Hide
]
마크업 주석은 PDF 내의 텍스트를 강조하거나 검토하는 데 사용됩니다.PDFContentEditor를 사용하면 사각형 영역, 주석 텍스트, 마크업 유형, 페이지 번호 및 색상을 지정하여 프로그래밍 방식으로 다양한 마크업 스타일을 적용할 수 있습니다.
- 생성하기 PDF 콘텐츠 편집기 목적.
- 입력 PDF를 바인딩합니다.
- 주석 사각형을 정의합니다.
- 마크업 주석 추가
- 업데이트된 문서를 저장합니다.
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_markup_annotation(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind document to PdfContentEditor
content_editor.bind_pdf(infile)
# Add markup annotation to page 1
content_editor.create_markup(
apd.Rectangle(120, 440, 200, 20),
"This is a highlight annotation",
0,
1,
apd.Color.yellow,
)
content_editor.create_markup(
apd.Rectangle(110, 542, 200, 20),
"This is a underline annotation",
1,
1,
apd.Color.yellow,
)
content_editor.create_markup(
apd.Rectangle(120, 568, 200, 20),
"This is a strikeout annotation",
2,
1,
apd.Color.orange_red,
)
content_editor.create_markup(
apd.Rectangle(110, 598, 200, 20),
"This is a squiggly annotation",
3,
1,
apd.Color.dark_blue,
)
# Save updated document
content_editor.save(outfile)