Tambahkan Anotasi Garis
Contents
[
Hide
]
Anotasi garis berguna untuk menekankan teks, menyoroti hubungan, atau menarik perhatian ke area tertentu dalam PDF. Dengan PdfContentEditor, Anda dapat secara programatis membuat anotasi garis dengan menentukan titik awal dan akhir, persegi panjang pembatas, warna, gaya border, dan ujung garis.
- Buat objek PdfContentEditor.
- Hubungkan PDF input.
- Definisikan properti Anotasi Garis.
- Tambahkan anotasi Garis.
- Simpan Document yang diperbarui.
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_line_annotation(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind input PDF file
content_editor.bind_pdf(infile)
# Create LineAnnotation object
rect = apd.Rectangle(100, 100, 200, 200)
contents = "This is line annotation"
content_editor.create_line(
rect,
contents,
100,
100,
200,
200,
1,
1,
apd.Color.red,
"Solid",
[3, 2],
["Square"],
)
# Save output PDF file
content_editor.save(outfile)