Hide a form field (button)

, ,

This is the first time I use PDFNet.
I can iterate all form fields but there is no method to show/hide.
EraseAppearance does not seem to have any effect.

 FieldIterator itr = doc.GetFieldIterator();
                    for (; itr.HasNext(); itr.Next())
                    {
                        Field field = itr.Current();
                        if (field.GetName() == "MyButton0")
                        {

                            ?????????
                            doc.Save("newsaved.pdf", SDFDoc.SaveOptions.e_remove_unused);
                       
                        }    
                        }
                

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

So that we can best assist, could you elaborate on why hiding form fields is important for you?
Can you just delete the Button?
Or you want to runtime toggle the Button Hide/Show?

I want to show and hide a text covered by a form field.
It can be easily done with Javascript but it’s not permanent and I do not want to use OCGs either.
Deleting the field manually in an editor works fine, but I’d like to do it in a way described in
my previous post.

Thank you in advance.

What viewer(s) do you expect this show/hide to work?
When exactly do you switch show/hide?
What is wrong with OCGs (which is how you would normally show/hide text).

I’ve already chosen a different product it’s much easier to use for my purposes.