Hi anyone,
Please help me on inserting the bookmark to my pdf.
I was suffering from this issue and tries several ways but still anything ddnt work for me.
I have used following method: ple help me on that
private void button1_Click(object sender, EventArgs e)
{
acPDFCreatorLib.Initialize();
// set license key
acPDFCreatorLib.SetLicenseKey("", "");
System.IO.FileStream file1 = new System.IO.FileStream("Html.pdf", System.IO.FileMode.Open);
IacDocument document = new IacDocument();
document.Open(file1, "");
int intTotalPages = document.PageCount;
Amyuni.PDFCreator.IacBookmark root = document.RootBookmark;
//Create New Bookmarks
Amyuni.PDFCreator.IacBookmark child = root.InsertChild(0, "Page [1]", "");
//root.InsertChild Index, Title, Object, BookMark
//Index: 0 based index where the child bookmark should be inserted
//Title: bookmark title
//Object: reference of the object where the bookmark should point
//if no object is selected, it will point to the top of the current page.
for (int intCtr = intTotalPages; intCtr >= 2; intCtr = intCtr - 2)
{
// Move to next page.
document.CurrentPage = document.GetPage(intCtr);
//insert child bookmarks, one per page with hidden ID (see next page)
root.InsertChild(1, "Page [" + intCtr + "]", "");
}
//Delete the bookmarks
child.Dispose();
root.Dispose();
//save the pdf file
System.IO.FileStream file2 = new System.IO.FileStream("Bookmarked.pdf", System.IO.FileMode.Create);
document.Save(file2, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveAll);
//Delete the document object
document.Dispose();
}
that is taken from the following link:
https://www.amyuni.com/downloads/Amyuni%20PDF%20Creator%20.NET.pdf (page 138)
Anyone please raise a hand for this..
i am in a deep trouble
