Extract Bookmark Content

Hi Team,

My requirment is to upload a PDF, copy contents on basis of bookmarks and create another PDF for the copied contents.

So first is :- I can get bookmarks using your API, but is it possible to copy all content of a bookmark and then copy it to another file (may be PDF or Word)?

If above is possible then I can go ahead and do different things and manipulate PDF in my application using your API.

Regards,

Amit

Hello Amit,

Thanks for considering Aspose.

Aspose.Pdf is a component which is used to generate PDF files from scratch. Whereas we have another component named Aspose.Pdf.Kit which is used to Manipulate/Edit existing PDF files. I am pleased to inform you that Aspose.Pdf.Kit has a class named [**PdfBookMarkEditor** ](http://www.aspose.com/com/aspose/pdf/kit/PdfBookMarkEditor.html) which offered various methods to [**extractBookMarks** ](http://www.aspose.com/com/aspose/pdf/kit/PdfBookMarkEditor.html#extractBookMarks())(), [**exportBookmarksToXML** ](http://www.aspose.com/com/aspose/pdf/kit/PdfBookMarkEditor.html#exportBookmarksToXML(java.lang.String))(), you can even extract Bookmarks with particular title using [**extractBookMarks** ](http://www.aspose.com/com/aspose/pdf/kit/PdfBookMarkEditor.html#extractBookMarks(java.lang.String))(java.lang.String title). Also you can Import the Bookmarks from XML file using [**importBookmarksWithXML** ](http://www.aspose.com/com/aspose/pdf/kit/PdfBookMarkEditor.html#importBookmarksWithXML(java.lang.String)). It also facilitates you to edit existing Bookmarks using [**modifyBookMarks**](http://www.aspose.com/com/aspose/pdf/kit/PdfBookMarkEditor.html#modifyBookMarks(java.lang.String,%20java.lang.String)) method. You can even delete bookmarks using [**deleteBookMarks**](http://www.aspose.com/com/aspose/pdf/kit/PdfBookMarkEditor.html#deleteBookMarks())()method. For more information please visit [**PdfBookMarkEditor** ](http://www.aspose.com/com/aspose/pdf/kit/PdfBookMarkEditor.html).

If it does not satisfy your requirement, please feel free to share.

Hi,

Thanks for the reply. I seen both Pdf.Kit and Pdf API. I know there is good support for bookmarks. But I dont know whether there is support for content for a bookmark. Class support extraction of Bookmark, but I did not find any method which can help you extract content of the Bookmark. It just fetch list of Bookmark or Information of Bookmark. Please note that my requirement is to extract every thing based on bookmark, be it image or text or format and I will copy content to another PDF so that selected bookmarks contents can be added in the newly generated PDF.

Regards,

Amit

Hello Amit,

Thank you for considering aspose product.
I am sorry that out kit can not support to extract the content of bookmark. The feature is meaningful but it is hard to be implemented. We have no plan to add such a new feature at the present day.

If you only extract the content of a page,you can do as below:
First,gets the destination page number of bookmark using PdfBookMarkEditor.ExtractBookMarks(),
then, you can get the page content using PdfFileEditor.Extract().

Any new news on this?? I’d like to iterate through the bookmarks and extract the text between each Bookmark and the next.

Hello Nathan,

Thanks for your interest in our products.

In case you need to extract the Bookmarks and their contents in .NET environment, then I am pleased to share that OutlineItemCollection class present under Aspose.Pdf for .NET is capable of dealing with Bookmarks and its properties. Please visit the following link for further details on

In case you need to extract the Bookmarks and their contents in Java environment, please try using PdfBookmarkEditor class present in Aspose.Pdf.Kit for Java.

In case I have not properly understood your requirement or you have any further query, please feel free to contact. We are sorry for your inconvenience.

I actually need all the text between a bookmark and the next.

Hello Nathan,

Do you mean you need to extract the Bookmark Title and the target paragraph to which its directing ? Please share some details so we may answer accordingly.

However please note that Aspose.Pdf.Facades has a class named PdfBookmarkEditor which provides the capability to export Bookmarks of PDF file into XML format and you may use the same XML file to import the Bookmarks into new PDF document. Please visit the following link for further details on Extract Bookmarks from an Existing PDF File (Facades) and also checkout Export Bookmarks to XML from an Existing PDF File (Facades)

We are sorry for your inconvenience.