文檔首頁>>Aspose.PDF使用教程>>Aspose.Pdf使用教程:從PDF文件中獲取注釋
Aspose.Pdf使用教程:從PDF文件中獲取注釋
PDF每頁的注釋都可以在該頁的注釋集合中找到,如果要找到某一個特定的注釋,就必須先為該注釋制定一個索引。
下面的代碼片段顯示了你如何獲得一個特定的注釋和它的屬性:
C#
//open document Document pdfDocument = new Document("input.pdf"); //get particular annotation TextAnnotation textAnnotation = (TextAnnotation)pdfDocument.Pages[1].Annotations[1]; //get annotation properties Console.WriteLine("Title : {0} ", textAnnotation.Title); Console.WriteLine("Subject : {0} ", textAnnotation.Subject); Console.WriteLine("Contents : {0} ", textAnnotation.Contents);
VB.NET
'open document Dim pdfDocument As New Document("input.pdf") 'get particular annotation Dim textAnnotation As TextAnnotation = CType(pdfDocument.Pages(1).Annotations(1), TextAnnotation) 'get annotation properties Console.WriteLine("Title : {0} ", textAnnotation.Title) Console.WriteLine("Subject : {0} ", textAnnotation.Subject) Console.WriteLine("Contents : {0} ", textAnnotation.Contents)