Добавить аннотацию кривой
Contents
[
Hide
]
Аннотации кривой используются для выделения нерегулярных путей или форм в PDF, обеспечивая визуальное акцентирование или маркировку важных областей. Используя PdfContentEditor, вы можете рисовать кривые, задавая последовательность вершин, стиль границы, видимость, прямоугольник аннотации и описательный текст.
- Создайте объект PdfContentEditor.
- Привяжите onput PDF.
- Настройте свойства Curve.
- Нарисуйте аннотацию Curve.
- Сохраните обновлённый 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_curve_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 = 1 # 1 - Dashed
line_info.vertice_coordinate = [120, 520, 160, 560, 220, 540, 280, 580]
line_info.visibility = True
content_editor.draw_curve(
line_info,
1,
apd.Rectangle(110, 510, 220, 100),
"This is curve annotation",
)
# Save output PDF file
content_editor.save(outfile)