How do I set default open/close states for Bookmarks in PDF?

Q: How do I set default open/close states for Bookmarks in PDF?

I have a PDF with bookmarks. I would that the Bookmarks are opened by
default when I open the document in Adobe Reader. I would like to
achieve this programmatically after generating the PDF file. Basically
I need to know if it’s possible to do this with the PDFNet library.
---------------
A: You can use bookmark.SetOpen() opens or closes the bookmark so that
it shows its children.
Use IsOpen() to check if a Bookmark is open.

Q: I already tried this, but it only works when the bookmarks side
window is opened. The SetOpen() function expands a bookmark in the
bookmark tree so you its children are visible.

What I needed was to be able to set the flag in the PDF’s m,etadata
that indicates that the side windows showing the Bookmark tree is
visible by defaut when you load the file in a PDF Viewer.


A: To tell a PDF viewer to displays document plus bookmarks pane use
SetPageMode() in pdftron.PDF.PDFDocViewPrefs. For example:

pdfdoc.GetViewPrefs().SetPageMode
(PDFDocViewPrefs.PageMode.e_UseBookmarks);