Esempio n. 1
0
        private void FillActionAnnotations(PDFLayoutContext context, Styles.Style style,
                                           PDFAction action, List <object> entries,
                                           Layout.PDFLayoutPage pg, ComponentList contents)
        {
            foreach (Component comp in contents)
            {
                PDFAnnotationLinkEntry annot;
                ComponentList          inner;
                if (IsContainer(comp, out inner))
                {
                    FillActionAnnotations(context, style, action, entries, pg, inner);
                }
                else
                {
                    //TODO: Test with data source within link
                    annot        = new PDFAnnotationLinkEntry(comp, style);
                    annot.Action = action;

                    if (!string.IsNullOrEmpty(this.AlternateText))
                    {
                        annot.AlternateText = this.AlternateText;
                    }

                    object entry = pg.RegisterPageEntry(context, PDFArtefactTypes.Annotations, annot);

                    if (null != entry)
                    {
                        entries.Add(entry);
                    }
                }
            }
        }
Esempio n. 2
0
        protected override void DoCloseLayoutArtefacts(PDFLayoutContext context, PDFArtefactRegistrationSet artefacts, Styles.Style fullstyle)
        {
            base.DoCloseLayoutArtefacts(context, artefacts, fullstyle);

            //Close the inner chid annotation entries
            object entries;

            if (artefacts.TryGetArtefact(LinkAnnotationChildEntries, out entries))
            {
                object[] all = (object[])entries;
                //TODO: Check the use of a link that flows over more than one page
                Layout.PDFLayoutPage pg = context.DocumentLayout.CurrentPage;

                for (int i = all.Length - 1; i >= 0; i--)
                {
                    pg.CloseArtefactEntry(PDFArtefactTypes.Annotations, all[i]);
                }
            }

            //Close the actual link
            object link;

            if (artefacts.TryGetArtefact(LinkArtefactName, out link))
            {
                context.DocumentLayout.CloseArtefactEntry(PDFArtefactTypes.Names, link);
            }
        }
Esempio n. 3
0
        private object[] AddActionAnnotationToChildren(PDFLayoutContext context, Styles.Style style, PDFAction action)
        {
            List <object> entries = new List <object>();

            Layout.PDFLayoutPage pg = context.DocumentLayout.CurrentPage;

            FillActionAnnotations(context, style, action, entries, pg, this.Contents);
            return(entries.ToArray());
        }