PDFsharp & MigraDoc Foundation

Modify PdfComboBoxField list values & value of the field
Page 1 of 1

Author:  nicolas.d [ Thu May 28, 2020 8:54 am ]
Post subject:  Modify PdfComboBoxField list values & value of the field


I'm trying to fill a PDF form with PDFsharp and there is no problems for fields like PdfTextField or PdfCheckBoxField.
But i encounter two problems with the ComboBoxField :
- I don't understand how to modify (add, delete or modify) the list of the values available for the combo field.
- Setting the value doesn't seem to works (My example code is right below)

// Open the file
PdfDocument pdf = PdfReader.Open(pdfFilePath);

PdfComboBoxField comboBoxField = (PdfComboBoxField)(pdf.AcroForm.Fields["FRM_CRM1_Marque"]);

if (comboBoxField != null)
    comboBoxField.Value = new PdfString("Choice 1");

// Save the document...

Do you know if it is possible to solve my two problems and how please?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group