Dear Team
Using below code, we are changing zoom of all bookmarks to “inherit zoom”. It is working fine. However for this particular file, some spaces in level 1 bookmark are removed in output file.
Please find code and attached input and output documents
public static void BookmarkBlankSpaces(String FileIn, String FileOut)
{
Document PdfDoc = new Document(FileIn);
PdfDoc.Save(FileOut);
string res = string.Empty;
string sourcePath = FileIn;
PdfBookmarkEditor pdfEditor = new PdfBookmarkEditor();
pdfEditor.BindPdf(sourcePath);
Bookmarks bookmarks = pdfEditor.ExtractBookmarks();
for (int i = 0; i < bookmarks.Count; i++)
{
bookmarks[i].PageDisplay_Zoom = 0;
bookmarks[i].PageDisplay = "XYZ";
}
pdfEditor.DeleteBookmarks();
for (int bk = 0; bk < bookmarks.Count; bk++)
{
if (bookmarks[bk].Level == 1)
pdfEditor.CreateBookmarks(bookmarks[bk]);
}
pdfEditor.Save(FileOut);
pdfEditor.Close();
}
PATE-CTAR_bookmark.zip (186.6 KB)
Thanks and Regards