How to Import Bookmark from xml to existing pdf?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

How to Import Bookmark from xml to existing pdf?

This post has NOT been accepted by the mailing list yet.

I am currently working on pdf projects (dotnet/c#[Itextsharp pdf]), I want to export and import bookmarks from one pdf to another pdf (both pdf are having same content, only difference are with bookmark/without bookmark and one is normal pdf and another linked pdf). Exporting bookmarks to xml is working fine but I don`t have the idea of importing exported bookmark(xml) to another pdf. Can any body suggest solution.

Here I am attaching my code.

string inputpdf = "D:\\chapter1.pdf"; string outputbookmark="D:\\chapter1Bookmark.xml";
        PdfReader reader = new PdfReader(inputpdf);
        IList<Dictionary<string, object>> bookmarks = SimpleBookmark.GetBookmark(reader);
        using (StreamWriter Sw = new StreamWriter(outputbookmark))
            SimpleBookmark.ExportToXML(bookmarks, Sw,"ISO8859-1", true);