Bookmarks

Bookmarks

Forum member · Jun 2, 2010
Hi: Is there any example in c# to add bookmarks to an existing .pdf file (with no bookmarks). Nothing fancy here, just 1 bookmark per page. Thanks, Thoai

Re: Bookmarks

Support · Jun 2, 2010
Hello Thoai, Yes, you can add bookmarks to existing PDF document without any problem using our DynamicPDF Merger product. You will have to use the Bookmark Page element to do this. Below is the sample code: MergeDocument document = new MergeDocument(@"Path for the input PDF document"); for (int i = 0; i < document.Pages.Count; i++) { document.Pages[i].Elements.Add(new Bookmark("Bookmark to page "+(i+1), 0, 0)); } document.Draw(@"Path to save the PDF document"); Thanks, ceTe Software Support Team

Re: Bookmarks

Forum member · Jun 2, 2010
This is great ... One more thing, instead of the static "Bookmark to page" string, I like to dynamically pull this string from the first line in bold of the pdf file. How am I supposed to achieve this? Thanks,

Re: Bookmarks

Support · Jun 2, 2010
Hello, You cannot read or extract static text that exists within the PDF document using the Merger for .NET product. You will have to know the text before hand when creating the bookmarks. Thanks, ceTe Software Support Team