Esempio n. 1
0
        public void FillFormTest()
        {
            var fieldsToFill = new Dictionary <string, string>();

            fieldsToFill["topmostSubform[0].Page1[0].Address[0].f1_7[0]"] = "Hello";

            IDictionary <string, PdfField> fields;

            using (var pdfStream = Assembly.GetAssembly(typeof(PdfService)).GetManifestResourceStream("PdfFormFiller.Common.Resources.fw9.pdf"))
            {
                var filler = new PdfService();

                var result = filler.FillForm(pdfStream, fieldsToFill);
                fields = filler.GetFormFields(result);
            }

            Assert.IsNotNull(fields);
            Assert.IsTrue(fields.Count > 0);
            Assert.IsTrue(fields.ContainsKey("topmostSubform[0].Page1[0].Address[0].f1_7[0]"));
            Assert.AreEqual(0, string.CompareOrdinal(fields["topmostSubform[0].Page1[0].Address[0].f1_7[0]"].Value, fieldsToFill["topmostSubform[0].Page1[0].Address[0].f1_7[0]"]));
        }