Remove few pages and related bookmarks from an existing PDF

Remove few pages and related bookmarks from an existing PDF

Forum member · May 16, 2021
Hi Team, I have a requirement where I have to delete few pages and it's related bookmarks from an existing PDF. I can delete the page using overloaded MergeDocument constructor which takes the starting page and the number of pages to merge. But the problem is that it retains all the bookmarks in the original PDF and if I set MergeOptions.Outlines = false, it removes all bookmarks. Is there any way to remove only particular bookmarks instead of all. Sample PDF contains bookmarks 1 to 10, and each bookmark points to pages 1 to 10. My output PDF should have bookmark 6-10 and pages 6-10. Thanks, Rob

Re: Remove few pages and related bookmarks from an existing PDF

Support · May 17, 2021
Hio Rob, Yes, you can append the required pages using the Append method of a MergeDocument object but by default it preserves all bookmarks in the source PDF. You can remove all bookmarks using the Outlines property of MergeOptions and then add new bookmarks to the PDF as needed. You can loop through outline list of the original PDF and add the required bookmarks to MergeDocument. Please refer to the documentation on reading outline information here . Also refer to the documentation on adding outlines and bookmarks here Thanks, ceTe Software Support Team

Re: Remove few pages and related bookmarks from an existing PDF

Forum member · May 18, 2021
Thanks, I achieved it by saving earlier bookmarks and recreate new ones based on it. But it would be nice, if you could provide it along with the extract options for the pages(the overloaded MergeDocument method) Thanks, Rob

Re: Remove few pages and related bookmarks from an existing PDF

Support · May 18, 2021
Hi Rob, We'll add that to the wish list and may implement it in a future version. Thanks, ceTe Software Support Team