I found the solution to my problem after studying the AddPage function a bit more. The function says that the returned page is not the same object as the specified one. I was adding the PdfPage "page" as a bookmark but what I really needed to do was declare another handle ("page2" in the code below) and add that as the bookmark.
// *** GOOD *** for (int idx = 0; idx < count; idx++) { page = inputDocument.Pages[idx]; PdfPage page2; page2 = outputDocument.AddPage(page); outline.Outlines.Add("SomeValue", page2, true); }
------------------------------------------------------------------
// *** DOES NOT WORK & RAISES ERROR *** for (int idx = 0; idx < count; idx++) { page = inputDocument.Pages[idx]; outputDocument.AddPage(page); outline.Outlines.Add("SomeValue", page, true); }
Thanks for responding to my post! This seems like a great project!
|