Remove few pages and related bookmarks from an existing PDF

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v10)  /  Re: Remove few pages and related bookmarks from an existing PDF

DynamicPDF CoreSuite for .NET (v10) Forum

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
Posted by a ceTe Software moderator
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
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
Posted by a ceTe Software moderator
Hi Rob,

We'll add that to the wish list and may implement it in a future version.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 9:12 PM.