Добавить круговую аннотацию
Contents
[
Hide
]
Круговые аннотации полезны для выделения областей интереса в PDF‑документе. С помощью PdfContentEditor, вы можете создавать круглые формы, указывая прямоугольник, определяющий границы круга, а также текст аннотации, цвет, параметры заливки, номер страницы и ширину рамки.
- Создайте объект PdfContentEditor.
- Привязать входной PDF.
- Определить границы круга.
- Добавить аннотацию круга.
- Сохранить обновлённый 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)