We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Using PdfLoadedComboBoxField where .Ietms.Count = 0 but the combofield has values

Am trying to use a customer PDF with this code

 PdfLoadedComboBoxField comboField = form.Fields[4] as PdfLoadedComboBoxField;
                PdfLoadedComboBoxItemCollection comboCollection = comboField.Items;
                PdfLoadedComboBoxItem item = comboCollection[0]; //This throws exception as .Ietms.Count = 0

However
comboField .Values[0] has  a value. 

How can I prefill the comboboxfield?


5 Replies

JB jb replied to jb February 19, 2015 06:57 PM UTC

Am trying to use a customer PDF with this code

 PdfLoadedComboBoxField comboField = form.Fields[4] as PdfLoadedComboBoxField;
                PdfLoadedComboBoxItemCollection comboCollection = comboField.Items;
                PdfLoadedComboBoxItem item = comboCollection[0]; //This throws exception as .Ietms.Count = 0

However
comboField .Values[0] has  a value. 

How can I prefill the comboboxfield?


attaching sample file

Attachment: Test_123ed2d5.zip


JB jb replied to jb February 19, 2015 07:23 PM UTC

Am trying to use a customer PDF with this code

 PdfLoadedComboBoxField comboField = form.Fields[4] as PdfLoadedComboBoxField;
                PdfLoadedComboBoxItemCollection comboCollection = comboField.Items;
                PdfLoadedComboBoxItem item = comboCollection[0]; //This throws exception as .Ietms.Count = 0

However
comboField .Values[0] has  a value. 

How can I prefill the comboboxfield?


attaching sample file

Attachment: Test_123ed2d5.zip

If possible can you provide code that would populate some combo box field and leave some empty and save the pdf? currently if i save the pdf with no entry in combobox field, i get a white space where combo box is instead of a rectangle


JB jb replied to jb February 19, 2015 08:23 PM UTC

Am trying to use a customer PDF with this code

 PdfLoadedComboBoxField comboField = form.Fields[4] as PdfLoadedComboBoxField;
                PdfLoadedComboBoxItemCollection comboCollection = comboField.Items;
                PdfLoadedComboBoxItem item = comboCollection[0]; //This throws exception as .Ietms.Count = 0

However
comboField .Values[0] has  a value. 

How can I prefill the comboboxfield?


attaching sample file

Attachment: Test_123ed2d5.zip

If possible can you provide code that would populate some combo box field and leave some empty and save the pdf? currently if i save the pdf with no entry in combobox field, i get a white space where combo box is instead of a rectangle

This is my code and figured out where the issue is

PdfLoadedDocument page1Document = new PdfLoadedDocument(path to my pdf file);
PdfDocument doc = new PdfDocument();
PdfLoadedForm form = page1Document.Form;
 (form.Fields[2] as PdfLoadedTextBoxField).Text = "ABC";
(form.Fields[4] as PdfLoadedComboBoxField).SelectedIndex = new string[] { "HELLO" };

 form.ReadOnly = true;

  form.Flatten = true;

  //Append the loaded document
  //AT THIS POINT THE COMBO BOX IS LOADED CORRECTLY IN page1Document             
  doc.Append(page1Document);
/  //AT THIS POINT THE COMBO BOX HAS NO DATA IN doc
 doc.Save(path);
 doc.Close();





AS Abirami Selvan Syncfusion Team February 21, 2015 05:33 AM UTC

Hi Jb,

Thank you for using Syncfusion Products.


As we have analyzed your code , We are able to reproduce the issue with “PdfComboBox is not displayed  when appending the loadeddocument  “and suspect this to be a defect. We will update you with further details on 24th  Feb 2015.

Thanks,
Abirami



AS Abirami Selvan Syncfusion Team February 24, 2015 12:21 PM UTC

Hi Jb ,

We were able to reproduce the problem and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Thanks ,
Abirami.

Loader.
Live Chat Icon For mobile
Up arrow icon