Пример #1
0
        static void Main(string[] args)
        {
            var applicationFolder           = AppDomain.CurrentDomain.BaseDirectory;
            var pdfFormFinder               = new PdfFormFinder(applicationFolder);
            var htmlFormFinder              = new HtmlFormFinder(applicationFolder);
            var formModelFinder             = new FormModelFinder(applicationFolder);
            var pdfFormFillingServiceFinder = new PdfFormFillingServiceFinder(applicationFolder);

            var pathToPdfForm               = pdfFormFinder.GetPath();
            var pathToHtmlForm              = htmlFormFinder.GetPath();
            var pathToFormModel             = formModelFinder.GetPath();
            var pathToPdfFormFillingService = pdfFormFillingServiceFinder.GetPath();

            CopyPdfFormToWebsite(pathToPdfForm);

            var formFields         = GetFormFields(pathToPdfForm);
            var filteredFormFields = FilterFormFields(formFields);

            var formMarkup = GenerateHtmlForFormFields(filteredFormFields);

            UpdateHtmlForm(formMarkup, pathToHtmlForm);

            var formModelContent = GenerateFormModel(formFields, pathToFormModel);

            UpdateFormModel(pathToFormModel, formModelContent);

            var pdfFormFillingServiceContent = GeneratePdfFormFillingService(formFields, pathToPdfFormFillingService);

            UpdatePdfFormFillingService(pathToPdfFormFillingService, pdfFormFillingServiceContent);
        }
Пример #2
0
        public void CanReachPdfFormFile()
        {
            var applicationFolder = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
            var pdfFormFinder     = new PdfFormFinder(applicationFolder.FullName);

            var result = pdfFormFinder.GetPath();
            var file   = new FileInfo(result);

            //File doesn't exist unless the website generation is done
            Assert.Equal("src.pdf", file.Name);
        }
Пример #3
0
        public void CanCopyPdfFormFile()
        {
            var pdfFormFinder      = new PdfFormFinder(AppDomain.CurrentDomain.BaseDirectory);
            var pdfFormDestination = pdfFormFinder.GetPath();

            if (File.Exists(pdfFormDestination))
            {
                File.Delete(pdfFormDestination);
            }

            Assert.False(File.Exists(pdfFormDestination));

            var pdfFormSource = @"FileManipulation\SamplePDFs\PRP-1-bos.pdf";

            FileCopier.CopyPdfFormToBlazorProject(pdfFormSource, pdfFormDestination);

            Assert.True(File.Exists(pdfFormDestination));
        }