Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
ExtractAnnotations メソッドを使用すると、PDFファイルから注釈を抽出できます。注釈を抽出するには、PdfAnnotationEditor オブジェクトを作成し、BindPdf メソッドを使用してPDFファイルをバインドする必要があります。その後、PDFファイルから抽出したい注釈タイプの列挙を作成する必要があります。
次に、ExtractAnnotations メソッドを使用して、注釈をArrayListに抽出できます。その後、このリストをループして個々の注釈を取得できます。最後に、PdfAnnotationEditor オブジェクトの Save メソッドを使用して、更新されたPDFファイルを保存します。以下のコードスニペットは、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.