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.