إضافة تعليقات توضيحية للترميز
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)