Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
La méthode ExtractAnnotations vous permet d’extraire des annotations d’un fichier PDF. Pour extraire des annotations, vous devez créer un objet PdfAnnotationEditor et lier le fichier PDF en utilisant la méthode BindPdf. Après cela, vous devez créer une énumération des types d’annotations que vous souhaitez extraire du fichier PDF.
Vous pouvez ensuite utiliser la méthode ExtractAnnotations pour extraire les annotations dans un ArrayList. Après cela, vous pouvez parcourir cette liste et obtenir des annotations individuelles. Et enfin, enregistrez le fichier PDF mis à jour en utilisant la méthode Save de l’objet PdfAnnotationEditor. Le code suivant vous montre comment extraire des annotations d’un fichier 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.