/// <summary>Adds a chained action.</summary> /// <param name="nextAction">the next action or sequence of actions that shall be performed after the current action /// </param> public virtual void Next(iText.Kernel.Pdf.Action.PdfAction nextAction) { PdfObject currentNextAction = GetPdfObject().Get(PdfName.Next); if (currentNextAction == null) { Put(PdfName.Next, nextAction.GetPdfObject()); } else { if (currentNextAction.IsDictionary()) { PdfArray array = new PdfArray(currentNextAction); array.Add(nextAction.GetPdfObject()); Put(PdfName.Next, array); } else { ((PdfArray)currentNextAction).Add(nextAction.GetPdfObject()); } } }
public static void SetAdditionalAction(PdfObjectWrapper <PdfDictionary> wrapper, PdfName key, iText.Kernel.Pdf.Action.PdfAction action) { PdfDictionary dic; PdfObject obj = wrapper.GetPdfObject().Get(PdfName.AA); if (obj != null && obj.IsDictionary()) { dic = (PdfDictionary)obj; } else { dic = new PdfDictionary(); } dic.Put(key, action.GetPdfObject()); wrapper.GetPdfObject().Put(PdfName.AA, dic); }
/// <summary> /// Adds an additional action to the provided /// <see cref="iText.Kernel.Pdf.PdfObjectWrapper{T}"/> /// < /// <see cref="iText.Kernel.Pdf.PdfDictionary"/> /// > wrapper. /// </summary> /// <param name="wrapper">the wrapper to add an additional action to</param> /// <param name="key"> /// a /// <see cref="iText.Kernel.Pdf.PdfName"/> /// specifying the name of an additional action /// </param> /// <param name="action"> /// the /// <see cref="PdfAction"/> /// to add as an additional action /// </param> public static void SetAdditionalAction(PdfObjectWrapper <PdfDictionary> wrapper, PdfName key, iText.Kernel.Pdf.Action.PdfAction action) { PdfDictionary dic; PdfObject obj = wrapper.GetPdfObject().Get(PdfName.AA); bool aaExists = obj != null && obj.IsDictionary(); if (aaExists) { dic = (PdfDictionary)obj; } else { dic = new PdfDictionary(); } dic.Put(key, action.GetPdfObject()); dic.SetModified(); wrapper.GetPdfObject().Put(PdfName.AA, dic); if (!aaExists || !dic.IsIndirect()) { wrapper.GetPdfObject().SetModified(); } }