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 ha=
ving same content, only difference are with bookmark/without bookmark and o=
ne is normal pdf and another linked pdf). Exporting bookmarks to xml is wor=
king 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 =3D "D:\\chapter1.pdf"; string outputbookmark=3D"D:=
\\chapter1Bookmark.xml";
PdfReader reader =3D new PdfReader(inputpdf);
IList<Dictionary<string, object>> bookmarks =3D SimpleBookmark.GetB=
ookmark(reader);
using (StreamWriter Sw =3D new StreamWriter(outputbookmark))
{
SimpleBookmark.ExportToXML(bookmarks, Sw,"ISO8859-1", true);
}
reader.Close();
My xml output file is
<?xml version=3D"1.0" encoding=3D"ISO8859-1"?>
<Bookmark>
<Title Color=3D"0 0 0" Page=3D"1 XYZ 36 806" Action=3D"GoTo" >Introductio=
n</Title>
<Title Color=3D"0 0 0" Page=3D"1 XYZ 36 410" Action=3D"GoTo" >Getting Sta=
rted
<Title Color=3D"0 0 0" Page=3D"1 XYZ 36 364" Action=3D"GoTo" >Printing =
a test page</Title>
<Title Color=3D"0 0 0" Page=3D"4 XYZ 36 740" Action=3D"GoTo" >Accessing=
the novaPDF Printing Preferences – test the multiline bookmark detec=
tion option</Title>
<Title Color=3D"0 0 0" Page=3D"5 XYZ 36 806" Action=3D"GoTo" >Creating =
PDF Files</Title>
</Title>
</Bookmark>
My Pdf file available in
http://www.novapdf.com/uploads/novapdf_en/media_items/pdf-example-bookmarks=
..original.pdf
Please suggest solution.