protected override void Execute(CodeActivityContext context)
        {
            try
            {
                var pdfFilePath = PDFFilePath.Get(context);
                var pdfReader   = new PdfReader(pdfFilePath);
                var fields      = pdfReader.AcroFields.Fields;

                if (fields.Count > 0)
                {
                    DataTable dtResults = new DataTable();
                    dtResults.Columns.Add("FieldName", typeof(string));
                    dtResults.Columns.Add("FieldValue", typeof(string));

                    foreach (var item in fields.Keys)
                    {
                        var fieldkey   = item.ToString();
                        var fieldValue = pdfReader.AcroFields.GetField(item.ToString());
                        dtResults.Rows.Add(fieldkey, fieldValue);
                    }
                    Results.Set(context, dtResults);
                }
                else
                {
                    var error = "An error occured while processing your request.";
                    ErrorMessage.Set(context, error);
                }
            }
            catch (Exception ex)
            {
                var error = "Error From Execute Method " + ex.Message;
                ErrorMessage.Set(context, error);
            }
        }
Esempio n. 2
0
        protected override void Execute(CodeActivityContext context)
        {
            PDFPath  = PDFFilePath.Get(context);
            WordPath = WordFilePath.Get(context);
            WordPwd  = WordFilePassword.Get(context);

            this.ConvertPdfToWord(PDFPath, WordPath, WordPwd);
        }