Bookmarks are not saved

Hi,
The following code should add a new bookmark to an existing document. However, when I open the saved document in Acrobat 7, no bookmarks appear.

PDFDocument doc = new DFDocument(@"C:\oldfile.pdf");
mark;
IPDFPage page = doc.Pages[1];
IPDFDestination target = doc.CreateDestination(page);
IPDFBookmark mark = doc.Bookmarks.Add("01 Feb 2007", target);

doc.Save(@"C:\newfile.pdf");
doc.Close();

Can you help?

3 Replies

DK Dhivya K Syncfusion Team February 2, 2007 01:44 PM UTC

Hi Rbluoin,

Thank you for your interest in Essential PDF.
Thanks for the code snippet. I was able to reproduce the issue. Currently it is not possible to insert the bookmarks into an existing document. However, as a workaround, we can copy the pages of the existing document and add them in a new PDFDocument object and then add bookmarks for this document.

Here is a sample for your reference:
Bookmarks.zip

Please take a look into it and let me know if it helps you.

Regards,
Dhivya.


RB Rblouin February 2, 2007 04:39 PM UTC

Thanks for your response. However, your code does not preserve bookmarks from the first document. In fact, when you open an existing PDF document, the PDFDocument.Bookmarks property is empty even though there are bookmarks in the document.

This is a bug. Please suggest a work-around.

Richard


DK Dhivya K Syncfusion Team February 5, 2007 01:58 PM UTC

Hi Richard,

Could you please refer the following thread regarding this issue?
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=55721

Thanks,
Dhivya.

Loader.
Up arrow icon