In order to get the Bookmark count, please try using following code snippet. In case I have not properly understood your requirement, please share some further details.
[C#]
//open document<o:p></o:p>
Aspose.Pdf.Document
pdfDocument = new Aspose.Pdf.Document("c:/pdftest/ABC.pdf");
//loop through all the bookmarks
foreach (OutlineItemCollection
outlineItem in pdfDocument.Outlines)
outlineItem.Count | 0 // Why the Count is zero ?, The Attachment PDF file contains the bookmark.
outlineItem.Title | "A" //The bookmark name display correct.
Hi Huang,
Thanks for sharing the resource file.
I have tested the scenario using bookmark.pdf and I am able to
notice that incorrect bookmark count is being returned. For the sake of correction, I have logged this problem
as PDFNEWNET-37274 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.
Thanks for your patience In reference to above logged issue, we would like to update you that in loop outlineItem.Count returns count of subitems of current bookmark. In order to get bookmark count (more correct count of bookmarks of highest level), you may use:
Console.WriteLine(doc.Outlines.Count);
var doc = newDocument(myDir
“bookmark.pdf”);<o:p></o:p>
//count of
bookmarks at document level
Console.WriteLine(doc.Outlines.Count);
//loop through all
the bookmarks
foreach (OutlineItemCollection outlineItem in doc.Outlines)