Esempio n. 1
0
        protected void Initialize(CodeActivityContext context)
        {
            doc = Document.Get(context);
            rec = Signer.Get(context);
            if (rec.RecipientType != "Signer")
            {
                throw new ArgumentException("Only Signers can have tabs added to them, not other Recipient types");
            }

            sigX = PositionX.Get(context);
            sigY = PositionY.Get(context);

            anchorText = AnchorText.Get(context);
            offsetX    = OffsetX.Get(context);
            offsetY    = OffsetY.Get(context);

            tabLabel   = TabLabel.Get(context);
            toolTip    = ToolTip.Get(context);
            pageNumber = PageNumber.Get(context);

            if (anchorText != null && anchorText != "" && Path.GetExtension(doc.filename) != ".pdf")
            {
                throw new FormatException("Can only use relative positioning on .pdf files");
            }
        }
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Object Container: Use objectContainer.Get<T>() to retrieve objects from the scope
            var objectContainer = context.GetFromContext <IObjectContainer>(TextApplicationScope.ParentContainerPropertyTag);

            // Inputs
            string inputText = objectContainer.Get <string>();

            // Inputs
            var anchorTextCol       = AnchorText.Get(context);
            var displayLog          = DisplayLog;
            var displayRegex        = DisplayRegex;
            var anchorTextParamText = AnchorTextParam.Get(context);

            //Convert Collection to Array
            string[] anchorText = Utils.ConvertCollectionToArray(anchorTextCol);

            //Output Data Row
            bool bUpdateDataRow  = BUpdateDataRow;
            var  myDataRow       = MyDataRow.Get(context);
            var  myDataRowColumn = MyDataRowColumn.Get(context);
            var  myIndex         = MyIndex.Get(context);

            string OutputString = null;

            ///////////////////////////
            // Add execution logic HERE
            string[] OutputResults = CallExtractions.CallExtractAllLinesBelowAnchorText(inputText, anchorText, anchorTextParamText, displayLog, displayRegex);

            #region Update Data Row (optional)
            //Check if functionality is Activated
            if (bUpdateDataRow == true)
            {
                //Check it there is an item to the Output Variable
                if (OutputResults.Length > 0)
                {
                    if (myIndex == -1)
                    {
                        //Upper Bound
                        OutputString = OutputResults[OutputResults.Length - 1];
                    }
                    else
                    {
                        OutputString = OutputResults[myIndex];
                    }

                    //Update Data Row
                    Utils.CallUpdateDataRow2(myDataRow, myDataRowColumn, OutputString);
                }
            }
            #endregion
            ///////////////////////////
            // Outputs
            return((ctx) =>
            {
                Results.Set(ctx, OutputResults);
            });
        }
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            recipientName    = RecipientName.Get(context);
            recipientEmail   = RecipientEmail.Get(context);
            subject          = Subject.Get(context);
            documentFilePath = DocumentFilePath.Get(context);
            sigX             = PositionX.Get(context);
            sigY             = PositionY.Get(context);

            anchorText = AnchorText.Get(context);
            offsetX    = OffsetX.Get(context);
            offsetY    = OffsetY.Get(context);

            if (anchorText != null && anchorText != "" && Path.GetExtension(documentFilePath) != ".pdf")
            {
                throw new FormatException("Can only use relative positioning on .pdf files");
            }

            LoadAuthentication(context);

            SendEnvelopeDelegate = new Action(SendEnvelope);
            return(SendEnvelopeDelegate.BeginInvoke(callback, state));
        }