Free Support Forum - aspose.com

Add a hyperlink to bookmarks that don't exist yet?

We use Aspose PDF to produce a PDF starting with a Table of Content (TOC).

We create the TOC for this PDF as a separate PDF first, then we append other PDF documents to this. This is all working well.

Because we know exactly how many pages each of the PDFs we are appending has, there is no problem figuring out what the Starting Page Number of each will be when we concatenate them all together. That’s why we can create the TOC first.

Then when we append all the other documents, we create Bookmarks to each as we append them. That’s also working just fine.

Now, however, we have been asked to enhance the TOC with Hyperlinks. Which presents us with a problem. As we create the TOC first, we don’t yet have the bookmarks to link to.

Is it possible to add a hyperlink to a bookmark to a document first, and then create the actual bookmark later?

If this is possible, could you kindly provide a small code sample illustrating this?

@kidkeogh

Sadly, it would not be possible as bookmarks are added to the Document.Outlines collection and while it is NULL, you will get an exception. In case you need further assistance, please feel free to let us know.

1 Like

Yes I was afraid that was going to be your answer… and due to no fault of yours, I hasten to add. I hope we can convince the recipient that with bookmarks in place there really is no justification for insisting on Hyperlinks as well.

@kidkeogh

Thanks for your feedback. Please feel free to start a new topic and let us know in case of any further inquiry or assistance.