4
Answers

How to Import Bookmark from xml to existing pdf?

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); } reader.Close();

Answers (4)