private void FillForm(PdfFormType type)
        {
            try
            {
                Directory.CreateDirectory(Paths.DownloadPath);
                string strTimeStamp = DateTime.Now.ToString("_hhmmss");
                string newFile;

                if (currentDevice.AssetTag == "NA")
                {
                    newFile = Paths.DownloadPath + currentDevice.Serial + " - " + currentDevice.Description + strTimeStamp + ".pdf";
                }
                else
                {
                    newFile = Paths.DownloadPath + currentDevice.AssetTag + " - " + currentDevice.Description + strTimeStamp + ".pdf";
                }

                if (type == PdfFormType.InputForm)
                {
                    using (PdfReader pdfReader = new PdfReader(Properties.Resources.Exh_K_01_Asset_Input_Formnew))
                    {
                        using (var newFileStream = new FileStream(newFile, FileMode.Create))
                            using (var pdfStamper = new PdfStamper(pdfReader, newFileStream))
                            {
                                AcroFields pdfFormFields = InputFormFields(currentDevice, pdfStamper);
                                if (pdfFormFields == null)
                                {
                                    return;
                                }
                                pdfStamper.FormFlattening = FlattenPrompt();
                            }
                    }
                }
                else if (type == PdfFormType.TransferForm)
                {
                    using (PdfReader pdfReader = new PdfReader(Properties.Resources.Exh_K_03_Asset_Transfer_Form))
                    {
                        using (var newFileStream = new FileStream(newFile, FileMode.Create))
                            using (var pdfStamper = new PdfStamper(pdfReader, newFileStream))
                            {
                                AcroFields pdfFormFields = TransferFormFields(currentDevice, pdfStamper);
                                if (pdfFormFields == null)
                                {
                                    return;
                                }
                                pdfStamper.FormFlattening = FlattenPrompt();
                            }
                    }
                }
                else if (type == PdfFormType.DisposeForm)
                {
                    using (PdfReader pdfReader = new PdfReader(Properties.Resources.Exh_K_02_Asset_Disposal_Form))
                    {
                        using (var newFileStream = new FileStream(newFile, FileMode.Create))
                            using (var pdfStamper = new PdfStamper(pdfReader, newFileStream))
                            {
                                AcroFields pdfFormFields = DisposalFormFields(currentDevice, pdfStamper);
                                if (pdfFormFields == null)
                                {
                                    return;
                                }
                                pdfStamper.FormFlattening = FlattenPrompt();
                            }
                    }
                }

                Process.Start(newFile);
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
        }
 public PdfFormFilling(ExtendedForm parentForm, Device device, PdfFormType pdfType)
 {
     this.parentForm = parentForm;
     currentDevice   = device;
     FillForm(pdfType);
 }