Beispiel #1
0
        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);
        }
Beispiel #2
0
        /// <summary>
        /// Adds an additional action to the provided
        /// <see cref="iText.Kernel.Pdf.PdfObjectWrapper{T}"/>
        /// &lt;
        /// <see cref="iText.Kernel.Pdf.PdfDictionary"/>
        /// &gt; 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();
            }
        }