Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
ExtractAnnotations metode memungkinkan Anda untuk mengekstrak anotasi dari file PDF. Untuk mengekstrak anotasi, Anda perlu membuat objek PdfAnnotationEditor dan mengikat file PDF menggunakan metode BindPdf. Setelah itu, Anda perlu membuat enumerasi jenis anotasi yang ingin Anda ekstrak dari file PDF.
Anda kemudian dapat menggunakan metode ExtractAnnotations untuk mengekstrak anotasi ke dalam ArrayList. Setelah itu, Anda dapat melakukan loop melalui daftar ini dan mendapatkan anotasi individu. Dan akhirnya, simpan file PDF yang diperbarui menggunakan metode Save dari objek PdfAnnotationEditor. Potongan kode berikut menunjukkan kepada Anda cara mengekstrak anotasi dari file 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.