Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
ExtractAnnotations تتيح لك استخراج التعليقات من ملف PDF. لاستخراج التعليقات، تحتاج إلى إنشاء كائن PdfAnnotationEditor وربط ملف PDF باستخدام طريقة BindPdf. بعد ذلك، تحتاج إلى إنشاء تعداد لأنواع التعليقات التي ترغب في استخراجها من ملف PDF.
يمكنك بعد ذلك استخدام طريقة ExtractAnnotations لاستخراج التعليقات إلى ArrayList. بعد ذلك، يمكنك التكرار عبر هذه القائمة والحصول على التعليقات الفردية. وأخيرًا، احفظ ملف PDF المحدث باستخدام طريقة Save لكائن PdfAnnotationEditor. يوضح لك مقتطف الكود التالي كيفية استخراج التعليقات من ملف PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ExtractAnnotation()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "AnnotationsInput.pdf"))
{
using (var annotationEditor = new Aspose.Pdf.Facades.PdfAnnotationEditor())
{
// Bind PDF document
annotationEditor.BindPdf(document);
// Extract annotations
var annotationTypes = new[] { Aspose.Pdf.Annotations.AnnotationType.FreeText, Aspose.Pdf.Annotations.AnnotationType.Text };
var annotations = annotationEditor.ExtractAnnotations(1, 2, annotationTypes);
foreach (var annotation in annotations)
{
Console.WriteLine(annotation.Contents);
}
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.