Free Support Forum - aspose.com

Show bookmarks when PDF doc is opened

Hi-
We combine/concatenate multiple documents of different types (word, excel, images…) in to a single PDF and generate bookmarks. After creating the bookmarks is there a way to programmatically make the bookmarks visible to users by default without the need for user to explicitly choose to view bookmarks after opening the document?


Hi Chan,

You may use
ChangeViewerPreference method of PdfContentEditor class to show the
bookmark panel by default. Please use the following code snippet to
achieve the goal:


//create PdfContentEditor object

PdfContentEditor editor = new PdfContentEditor();

//bind input PDF file

editor.BindPdf(“input.pdf”);

//change Viewer Preferences

editor.ChangeViewerPreference(ViewerPreference.PageModeUseOutlines);

//save output PDF file


editor.Save(“output.pdf”);


I hope this helps. If you have any further questions, please do let us know.
Regards,