PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Oct 15, 2019 5:59 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Sep 13, 2019 9:08 pm 
Offline

Joined: Fri Sep 13, 2019 8:41 pm
Posts: 3
Hi,

Using PDFSharp 1.50.5147.0:

1. Is there a way to fill a pdf form field (type: PdfComboBoxField) using text value instead index.
and allow to add it if it doesn't exist?

2. Is it possible to retrieve PdfComboBoxField value (or any other fields type that can have validation values)? If yes how?

Thanks


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 17, 2019 1:51 pm 
Offline

Joined: Fri Sep 13, 2019 8:41 pm
Posts: 3
I found a solution for my case, maybe it's not elegant, but it did the trick: (PDFSharp V. 1.50.5147.0)

Here is the solution:

Code:
PdfComboBoxField cbxField;
if ((cbxField = field as PdfComboBoxField) != null)
{
   cbxField.Value = new PdfString("( )");
   cbxField.Value = new PdfString(MyValue);  //MyValue is not required to be in the combobox choice list
}

//Notes:
// cbxField.Value = new PdfString("(" + MyValue + ")");  //MyValue must be in the combobox and it will be displayed with the parentheses in the pdf form.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 336 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group