Hello, I figured out the basic way to add a bookmark to an existing PDF.
foreach (string s in selectedFiles) { PdfDocument document = PdfReader.Open(s, PdfDocumentOpenMode.Modify);
int count = document.PageCount; PdfPage page; for (int idx = 0; idx < count; idx++) { page = document.Pages[idx]; document.Outlines.Add("SomeValue", page, true); } document.Save(s); Process.Start(s);
}
basically I'm just adding a bookmark for every page. The "SomeValue" is the title of the bookmark. Basically you will just have add a condition for adding a bookmark. I am still looking into this myself.
|