Aspose.pdf Key cannot be null. Parameter name: key

Hi Team,


while reading Field Details, I am getting “Key cannot be null.Parameter name: key”, below is the code which I am using to find more detail about the pdf field. I am using Aspose.pdf 7.3.0.0 version

Dim license As Aspose.Pdf.License = New Aspose.Pdf.License()
license.SetLicense(“Aspose.Total.lic”)
Dim PDFFileName As String = "d:\temp\iShuttleDisplay(1).pdf"
Dim document As New Aspose.Pdf.Document(PDFFileName)
Dim pdfForm1 As New Aspose.Pdf.Facades.Form(document )

'getting error in below line

Dim fieldFacade As Aspose.Pdf.Facades.FormFieldFacade =pdfForm1.GetFieldFacade(“INITIALA01_445”)

'The same error is throwing at the time of updating form field value

pdfForm1.FillField(“INITIALA01_445”, “xyz”)

Hi Yogi,


Thanks
for using our products.<o:p></o:p>

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35649. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

Thanks buddy,


In my further investigation I found that this issue occurred because of BLANK field name in PDF. We are creating PDF file from DOC file using aspose.word DLL, In DOC file we have added the bookmark field so that we can use them as field in PDF File, I noticed, for few bookmark we didnt assigned a name, so while saving DOC to PDF, blank name fields are get created.

Anyway I found the following work around for this issue, i am checking blank field name in pdf file and assigning random name to it if found any BLANK field name

Dim pdfdocument As New Aspose.Pdf.Document(pdfFileName)
For Each formField As Field In pdfdocument.Form
Dim f As Field = formField
If f.PartialName <> “” AndAlso Not f.PartialName Is Nothing AndAlso Not f.PartialName.StartsWith("") Then
'Do nothing

Else
f.PartialName = Guid.NewGuid().ToString().Replace("-", "")
End If
Next formField
pdfdocument.Save(pdfFileName)

Hi Yogi,


Thanks for your feedback. Its good to know that you found a workaround to resolve you issue. However, I would like to update you that we’ve resolved your reported issue and its fix will be included in upcoming version of Aspose.Pdf for .NET i.e 8.4. We’ll update you as soon as its released and gets available for download.

Best Regards,

The issues you have reported earlier (filed as PDFNEWNET-35649) have been fixed in Aspose.Pdf for .NET 8.4.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.