Example #1
0
        static public int AddActionsGoToE(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }
            IPXC_Bookmark bookmark = null;

            if (Parent.SelectedBookmarkNode == null)
            {
                bookmark = Parent.m_CurDoc.BookmarkRoot.AddNewChild(true);
            }
            else
            {
                bookmark = Parent.SelectedBookmarkNode.m_Bookmark.AddNewSibling(false);
            }

            IPXS_Inst       pxsInst     = Parent.m_pxcInst.GetExtension("PXS");
            uint            atomGoToE   = pxsInst.StrToAtom("GoToE");
            IPXC_NameTree   attachments = Parent.m_CurDoc.GetNameTree("EmbeddedFiles");
            IPXS_PDFVariant var         = null;

            try
            {
                var = attachments.Lookup("FeatureChartEU.pdf");
            }
            catch (Exception)
            {
                string                  sFilePath = System.Environment.CurrentDirectory + "\\Documents\\FeatureChartEU.pdf";
                IPXC_FileSpec           fileSpec  = Parent.m_CurDoc.CreateEmbeddFile(sFilePath);
                IPXC_EmbeddedFileStream EFS       = fileSpec.EmbeddedFile;
                EFS.UpdateFromFile2(sFilePath);
                var = fileSpec.PDFObject;
            }

            attachments.Add("FeatureChartEU.pdf", var);

            IPXC_Action_Goto actionGoToE = Parent.m_pxcInst.GetActionHandler(atomGoToE).CreateEmptyAction(atomGoToE, Parent.m_CurDoc) as IPXC_Action_Goto;

            IPXC_GoToETargetPath targetPath = actionGoToE.TargetPath;
            IPXC_GoToETargetItem targetItem = targetPath.InsertNew();

            targetItem.FileName   = "FeatureChartEU.pdf";
            targetItem            = targetPath.InsertNew();
            targetItem.FileName   = "MyStamps.pdf";
            targetItem            = targetPath.InsertNew();
            targetItem.AnnotIndex = 0;
            targetItem.PageNumber = 0;

            IPXC_ActionsList aList = Parent.m_CurDoc.CreateActionsList();

            bookmark.Title = "GoToE Action";
            bookmark.Style = PXC_BookmarkStyle.BookmarkFont_Normal;
            aList.Insert(0, actionGoToE);
            bookmark.Actions = aList;

            Marshal.ReleaseComObject(attachments);

            return((int)Form1.eFormUpdateFlags.efuf_Bookmarks | (int)Form1.eFormUpdateFlags.efuf_Attachments);
        }
Example #2
0
        static public int AddActionNamed(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                Document.CreateNewDoc(Parent);
            }
            IPXC_Bookmark bookmark = null;

            if (Parent.SelectedBookmarkNode == null)
            {
                bookmark = Parent.m_CurDoc.BookmarkRoot.AddNewChild(true);
            }
            else
            {
                bookmark = Parent.SelectedBookmarkNode.m_Bookmark.AddNewSibling(false);
            }

            IPXS_Inst         pxsInst     = Parent.m_pxcInst.GetExtension("PXS");
            uint              atomNamed   = pxsInst.StrToAtom("Named");
            IPXC_Action_Named actionNamed = Parent.m_pxcInst.GetActionHandler(atomNamed).CreateEmptyAction(atomNamed, Parent.m_CurDoc) as IPXC_Action_Named;

            actionNamed.CmdName = "NextPage";
            IPXC_ActionsList aList = Parent.m_CurDoc.CreateActionsList();

            bookmark.Title = "Execute Command Action";
            bookmark.Style = PXC_BookmarkStyle.BookmarkFont_Normal;
            aList.Insert(0, actionNamed);
            bookmark.Actions = aList;

            return((int)Form1.eFormUpdateFlags.efuf_Bookmarks);
        }