خرید بک لینک

Vote count: 0

I have a PDF template that I use to populate with data for customers. I am using the code below to populate the fields on the template and save the template to a temp folder for processing by a web service. For some reason, the fields are empty when the document is created even though when stepping through in VS, the variables contain the data.

Any help would be great!

Method code:

 public string GenerateDoc(RequestViewModel model, string templatePath, string pdfTemplate)  //TODO: Fix this, the fields are not populating
        {
            decimal amt = 0;
            WebSupergoo.ABCpdf10.Doc template = new WebSupergoo.ABCpdf10.Doc();
            template.Read(Path.Combine(templatePath, pdfTemplate));
            string[] fieldNames = template.Form.GetFieldNames();
            var payoffTotal = Decimal.TryParse(model.Fee, out amt) == true ? (amt + model.PayoffAmt) : 0;
            foreach (string field in fieldNames)
            {
                Field txtDate = template.Form[field];
                txtDate.Value = DateTime.Now.ToShortDateString();
                Field txtClient = template.Form[field];
                txtClient.Value = model.CustName;
                Field txtAccount = template.Form[field];
                txtAccount.Value = model.AcctNumber;
                Field txtEffective = template.Form[field];
                txtEffective.Value = model.PayoffDate.ToString();
                Field txtPayoff = template.Form[field];
                txtPayoff.Value = model.PayoffAmt.ToString();
                Field txtFee = template.Form[field];
                txtFee.Value = model.Fee.ToString();
                Field txtTotal = template.Form[field];
                txtTotal.Value = payoffTotal.ToString();
                Field txtPerdiem = template.Form[field];
                txtPerdiem.Value = model.PerDiem.ToString();
            }
            var outputPDFName = model.AcctNumber + "-" + model.CustName + "-" + DateTime.Now.ToString("MMddyyyy--HH-mm-ss");
            template.Save(Path.Combine(model.OutputPath, outputPDFName));
            retu outputPDFName;
        }

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 25 خرداد 1395 ساعت: 20:38

صفحه بندی