private void FillDocument(PdfLoadedDocument document)
        {
            PdfLoadedForm form = document.Form;

            form.SetDefaultAppearance(false);
            (form.Fields[0] as PdfLoadedTextBoxField).Text     = name.Text;
            (form.Fields[1] as PdfLoadedTextBoxField).Text     = BusName.Text;
            (form.Fields[2] as PdfLoadedCheckBoxField).Checked = (Individual.IsChecked) ?? false;
            (form.Fields[3] as PdfLoadedCheckBoxField).Checked = Corporation.IsChecked ?? false;
            (form.Fields[4] as PdfLoadedCheckBoxField).Checked = Partnership.IsChecked ?? false;
        }
Ejemplo n.º 2
0
        private void FillDocument(PdfLoadedDocument document)
        {
            //Get the PDF form from the document.
            PdfLoadedForm form = document.Form;

            //Set default appearance to false, to create a appearance.
            form.SetDefaultAppearance(false);

            //Get formatted date for date of birth
            var      dateTimeOffset = dateofbirth.Date;
            DateTime time           = dateTimeOffset.Value.DateTime;
            string   formatedTime   = time.ToString("MMMM d, yyyy");

            //Set the date of birth to text box field.
            (form.Fields[0] as PdfLoadedTextBoxField).Text = formatedTime;
            //Set the name to text box field.
            (form.Fields[1] as PdfLoadedTextBoxField).Text = name.Text;
            //Set the email to text box field.
            (form.Fields[2] as PdfLoadedTextBoxField).Text = email.Text;

            int selectedIndex = 0;

            if ((bool)Unspecified.IsChecked)
            {
                selectedIndex = 1;
            }
            else if ((bool)Female.IsChecked)
            {
                selectedIndex = 2;
            }
            //Set the selected value to PdfLoadedRadioButtonListField.
            (form.Fields[3] as PdfLoadedRadioButtonListField).SelectedIndex = selectedIndex;
            //Set the selected city to PdfLoadedComboBoxField.
            (form.Fields[4] as PdfLoadedComboBoxField).SelectedValue = fromCity.SelectedValue.ToString();
            //Set the selected value to PdfLoadedCheckBoxField.
            (form.Fields[5] as PdfLoadedCheckBoxField).Checked = newsletter.IsChecked ?? false;
        }