Given a specific PDF document that I have, using PDFsharp, I want to go over its bookmarks/outlines. For some of these outlines, an /A is defined. I want to get /A's content. However, I was unable to find it.
For example, one of the outlines is defined as follows:
7142 0 obj
<</Title <FEFF00430031>
/Count -2
/First 7143 0 R
/Last 7144 0 R
/Parent 7141 0 R
/Next 7145 0 R
/A 928 0 R
>>
endobj
I want to get the /A 928 0 R line.
Given a PdfOutline that represents this object, I can (1) get its object id using Internals.ObjectId. (2) get title, first, last, parent, next using the Elements dictionary.
I can't, however, manage to get the /A part. I would appreciate help with that!
(I do know that I can get 928's defined /GoTo action using Element["/Dest"]. However, I am not interested in that. Ultimately, I'm interested in the "928" value. (Since object 929 is actually what I'm after, which I currently find using document.Internals.GetObject(), but this is probably unrelated.))
If I try using
docSharp.Internals.GetObject(C1.Internals.ObjectID)
I get the same thing. Instead of showing a /A 928 0 R line, I get 928's contents /Dest [ 10 0 R /FitR 376 799 1115 354 ].
I finally found this PDFsharp forum post (after posting there as well).
Using the
outline.Elements.GetDictionary("/First");way of accessing the outlines got me what I wanted. Given a PdfDictionary d that represent my corresponding outline, I can get the "/A" value usingd.Elements.GetString("/A");.Traversal through the PDF objects is done using the "/First", and "/Next" keys on d.Elements.GetString.