We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Fill in Form - Object not found

Hi,


I am trying to fill in our PDF form with the code below, The template.FieldName returns all the field names as expected, and the case statement get hit appropriately.
However upon executing template.FillField(field, DateTime.Today.ToShortDateString()), it returns Object reference not set to an instance of an object.

Stack Trace is :
at –.˜.(String unicodeString, ‹ resources, noCharacterAction, Boolean isEmbedded, Boolean isSubset, ‚& encodedString, & selectedFont, String& fontResourceKey)
at ”.“.’ž(•[] choosingStrategies, String unicodeString, ‹ resources, noCharacterAction, Boolean isEmbedded, Boolean isSubset, ‚& encodedText, & selectedFont, String& fontResourceKey)
at ”.“.’(String text, ‹ resources, ‚& encoded, & selectedFont, String& fontKey)
at Aspose.Pdf.InteractiveFeatures.Forms.TextBoxField.ae(™ , Annotation )
at Aspose.Pdf.InteractiveFeatures.Annotations.WidgetAnnotation.›(Annotation )
at Aspose.Pdf.InteractiveFeatures.Forms.Field.›()
at Aspose.Pdf.InteractiveFeatures.Forms.Field.(String )
at Aspose.Pdf.InteractiveFeatures.Forms.Field.set_Value(String value)
at Aspose.Pdf.InteractiveFeatures.Forms.TextBoxField.set_Value(String value)
at Aspose.Pdf.Facades.Form.FillField(String fieldName, String fieldValue)
at

Code:
foreach (var fieldname in template.FieldNames)
{
var field = template.GetFullFieldName(fieldname);
switch (fieldname)
{
case “Date”:
{
template.FillField(field, DateTime.Today.ToShortDateString());
template.FlattenField(fieldname);
break;
}

case “NameAddress”:
{
template.FillField(fieldname, “This is Name and Address”);
break;
}

case “CustomerName”:
{
template.FillField(fieldname, “This is Customer Name”);
break;
}
}
}

Hi,


Thanks
for using our API’s.<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-39103. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

Is there any update on this issue? I’m having the exact same problem in Aspose.Pdf for .NET 11.2, and I don’t see any reference to this issue in the release notes for subsequent releases.

jlhamilt:
Is there any update on this issue? I’m having the exact same problem in Aspose.Pdf for .NET 11.2, and I don’t see any reference to this issue in the release notes for subsequent releases.
Hi,

Thanks for using our API’s.

The issue reported earlier is not yet resolved but such scenarios a very much dependent upon the input file being used, so we request you to please share the code snippet and input form which you are using, so that we can test the scenario in our environment.

We are sorry for your inconvenience.