/// <summary> /// Class constructor. /// </summary> /// <param name="objectId">The object id number</param> /// <param name="title">The title of the outline entry (can only be null for root Outlines obj)</param> /// <param name="action">The page which this outline refers to.</param> public PdfOutline(PdfObjectId objectId, string title, PdfObjectReference action) : base(objectId) { this.subentries = new ArrayList(); this.count = 0; this.parent = null; this.prev = null; this.next = null; this.first = null; this.last = null; this.title = title; this.actionRef = action; }
/// <summary> /// Add a sub element to this outline /// </summary> /// <param name="outline"></param> public void AddOutline(PdfOutline outline) { if (subentries.Count > 0) { outline.prev = (PdfOutline)subentries[subentries.Count - 1]; outline.prev.next = outline; } else { first = outline; } subentries.Add(outline); outline.parent = this; IncrementCount(); // note: count is not just the immediate children last = outline; }
public PdfOutline makeOutline(PdfOutline parent, string label, string destination) { PdfObjectReference goToRef = getGoToReference(destination); PdfOutline obj = new PdfOutline(doc.NextObjectId(), label, goToRef); if (parent != null) { parent.AddOutline(obj); } this.objects.Add(obj); return obj; }
public PdfOutline getOutlineRoot() { if (outlineRoot != null) { return outlineRoot; } outlineRoot = new PdfOutline(doc.NextObjectId(), null, null); addTrailerObject(outlineRoot); doc.Catalog.Outlines = outlineRoot; return outlineRoot; }