I am attempting to create an outline for a PDF and I am encountering an issue.
Document doc = new Document();
doc.Pages.Add();
doc.Pages.Add();doc.Outlines.Add(new OutlineItemCollection(doc.Outlines));
doc.Outlines.Last.Title = “Page 1”;
doc.Outlines.Last.Action = new GoToAction(doc.Pages[1]);doc.Outlines.Add(new OutlineItemCollection(doc.Outlines));
doc.Outlines.Last.Title = “Page 2”;
doc.Outlines.Last.Action = new GoToAction(doc.Pages[2]);doc.Save(“out.pdf”);
Document doc = new Document();
doc.Pages.Add();
doc.Pages.Add();OutlineItemCollection outline1 = new OutlineItemCollection(doc.Outlines);
outline1.Title = “Page 1”;
outline1.Action = new GoToAction(doc.Pages[1]);
doc.Outlines.Add(outline1);OutlineItemCollection outline2 = new OutlineItemCollection(doc.Outlines);
outline2.Title = “Page 2”;
outline2.Action = new GoToAction(doc.Pages[2]);
doc.Outlines.Add(outline2);doc.Save(“out.pdf”);