facebooktwittermenuarrow-up

GemBox Support Forum

Changing the value of a PdfTextField

Hello,

I tried to extend the Fill in Form example in order to set the Value of a PdfTextField.

Just added the snipplet to show the name as text:

Dim i As Integer = 0
For Each field As PdfField In document.Form.Fields
    If TypeOf field Is PdfTextField Then
            Dim textField As PdfTextField = field
            textField.Value = textField.Name & "_" & i
            i = i + 1
    End If
Next

However i always get the error:

System.TypeInitializationException: “The type initializer for ' ’ threw an exception.”
Inner exception
FileNotFoundException: Could not load file or assembly ‘System.IO.Packaging, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. Das System kann die angegebene Datei nicht finden.

Could you please extend the example to show how the change the text of a PdfTextField?

Thanks and kind regards,
Sven

Hi Sven,

I was unable to reproduce your issue.

I tried the snippet code you provided, the following is the screenshot of the resulting PDF that I get:

Can you please send us your VS project so that we can reproduce your issue and investigate it?

Regards,
Mario

Hello Mario,

I uploaded it to github. See https://github.com/Kyubu-77/FillTextBox_ErrorCase

thanks for the quick response and kind regards,
Sven

Hallo Mario,

ok i got it working. The “Could not load file or assembly ‘System.IO.Packaging, Version=4.0.5.0” occures then you are using TargetFramework netcoreapp3.1 but referencing the GemBox.Pdf for net35. Referencing the GemBox.Pdf of the /netcoreapp3.1 folder solves it.

thanks and kind regards,
Sven