[PDFSharp - Fillable PDF] Unable to cast object of type Radio Button

Forge Component
(5)
Published on 5 Jun (11 days ago) by Pedro Ramalho
5 votes
Published on 5 Jun (11 days ago) by Pedro Ramalho

Hi Team,

I have received the following error when trying to generate the PDF:

Unable to cast object of type 'PdfSharp.Pdf.AcroForms.PdfRadioButtonField' to type 'PdfSharp.Pdf.AcroForms.PdfComboBoxField'.

My editable PDF contains 2 checkbox's.

It seems that this is a known problem for PDFsharp library.

Anyone already experienced something similar?

Cheers,

Pedro Domingues

Hi Pedro,


I didn't understand what's the real problem. 

You don't have any radio button in your PDF? Do you only have checkboxes?

In my example, I have 4 checkboxes and you can check each one of them.


Pedro Ramalho



Pedro Domingues wrote:

Hi Team,

I have received the following error when trying to generate the PDF:

Unable to cast object of type 'PdfSharp.Pdf.AcroForms.PdfRadioButtonField' to type 'PdfSharp.Pdf.AcroForms.PdfComboBoxField'.

My editable PDF contains 2 checkbox's.

It seems that this is a known problem for PDFsharp library.

Anyone already experienced something similar?

Cheers,

Pedro Domingues



Hi Pedro,

Indeed, my PDF generates 2 checkboxes but, under the hood, they are considered radio button.

Despite they're checkboxes, it doesn't allow me to select both options. It seems that they're being rendered as radio buttons under the hood instead of real checkboxes.

EDIT:

It seems i cannot upload images... 

Hi Pedro,


Then that's the problem. The component doesn't support radio buttons, as it is. 

But that behavior is the expected for radio buttons, one option always excludes the others. 


Cheers,

Pedro Ramalho

That's what i thought...

Thanks Pedro!

Solution

Hi Pedro,

I figured out how to solve that. It seems that your .NET extension wasn't handling the Radio buttons types. I've added that piece of code to handle Radio Buttons and now it's working as expected.

Cheers,

Solution

Hi Pedro, 


Yes, my .NET extension does not support Radio buttons, but it's nice that you added the piece of code that you need.


Cheers,

Pedro Ramalho