Change value of form field

Hello,

I want to change a value of a form field in a PDF document.
The field is ReadOnly, but anyway I don’t see it if I go through the fields or try to fill it.

I tried this:

            Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fileNameTempPDF);
            foreach (Aspose.Pdf.Forms.Field formField in pdfDocument.Form.Fields)
            {
                if (formField.Name == "Beruf_copy1")
                {
                    if (formField.ReadOnly)
                        formField.ReadOnly = false;
                    formField.Value = "test";
                }
            }
            pdfDocument.Save(Path.Combine(fileNameTempPDF, fileNameTempPDF.Replace(".pdf", "_cleaned.pdf")));

Or this:

Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form(fileNameTempPDF);
pdfForm.FillField(“Beruf_copy1”, “test”);
pdfForm.Save(Path.Combine(fileNameTempPDF, fileNameTempPDF.Replace(".pdf", “_cleaned.pdf”)));
pdfForm.Close();

Both don’t work. How can I do this?
The file is attached.

Regards RingoAntrag.pdf (1.2 MB)

@GEWA-COMP_GmbH

We have tested the scenario using the latest version of Aspose.PDF for .NET 22.3 with following code example and have not found the shared issue. We have attached the output PDF with this post for your kind reference.
pdfForm 22.3.pdf (1.1 MB)

Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form(MyDir + "Antrag.pdf");
pdfForm.FillField("Beruf_copy1", "Test Value");
pdfForm.Save(MyDir + "pdfForm 22.3.pdf");

Hello,

thank you. With the latest version Aspose.PDF for .NET 22.3 it works (in .NetFramework 4.7.2).

We just still have a problem to compile it with netstandard 2.0. We get a warning "… instead of the project target framework ‘.NETStandard,Version=v2.0’.* *This package may not be fully compatible with your project.”
In your description there ist no netstandard 2.0 supported but netstandard 2.1. Ist this right? Normally it should work with netstandard 2.0 too. All your other products work with it.
We want to compile it with netstandard 2.0.

Best regards
Ringo

@GEWA-COMP_GmbH

Aspose.PDF for .NET is not available for .NET Standard 2.0. We have logged this issue as PDFNET-51559 in our issue tracking system. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

You can use .NET Standard 2.1 with Aspose.PDF for .NET.