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

Free Support Forum - aspose.com

Programmatically filling pdf does not update formatting

Hello,

I have a fillable form pdf and I am using aspose to fill out the form with information. The pdf fields already have formatting available (standard currency format) and some fields have validation and calculation javascript.

When I fill the formatted fields with a decimal, all I get are the numbers. No formatting.
When I fill the formatted fields with a formatted string for currency, the field values are no longer numbers and they break the validation/calculation javascript.

How can I trigger the field to correctly format the data in the field after using aspose to populate the data?

Example of how I am filling the field:
-produces just numbers, does not trigger the native pdf formatting
forms.FillField(“Monthly_Ded_Amt1”, Math.Ceiling(decimalVar).ToString)

-correct formatting, but cannot use value of field when validating/calculating with javascript
forms.FillField(“Monthly_Ded_Amt1”, FormatCurrency(Math.Ceiling(decimalVar)))

Thanks for any help!

Hi Adrian,


Thanks for using our API’s.

Can you please share the resource form file, so that we can test the scenario in our environment. We are sorry for this inconvenience.

Yep. Attached. The fields in question are on the 2nd to last page (or any field that has formatting embedded in the doc):


Monthly_Ded_Amt1
Total_Ded_Amt1

just a heads up, I updated the javascript to strip the custom formatting while calculating so no rush for the answer. Would still appreciate one for future and so I don’t have to modify other companys’ pdf files.


Thanks

ahoffman:
I have a fillable form pdf and I am using aspose to fill out the form with information. The pdf fields already have formatting available (standard currency format) and some fields have validation and calculation javascript.

When I fill the formatted fields with a decimal, all I get are the numbers. No formatting.

Example of how I am filling the field:
-produces just numbers, does not trigger the native pdf formatting
forms.FillField(“Monthly_Ded_Amt1”, Math.Ceiling(decimalVar).ToString)
Hi Adrian,

Thanks for sharing the resource file.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNEWNET-40702 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

ahoffman:
-correct formatting, but cannot use value of field when validating/calculating with javascript
forms.FillField(“Monthly_Ded_Amt1”, FormatCurrency(Math.Ceiling(decimalVar)))
Hi Adrian,

It appears that FormatCurrency(…) is your custom defined method, so can you please share the complete code snippet, so that we can test the scenario in our environment. We are sorry for this inconvenience.

FormatCurrency is a built in function for vb.net


https://msdn.microsoft.com/en-us/library/3352e6f5(v=vs.90).aspx
ahoffman:
I have a fillable form pdf and I am using aspose to fill out the form with information. The pdf fields already have formatting available (standard currency format) and some fields have validation and calculation javascript.

When I fill the formatted fields with a formatted string for currency, the field values are no longer numbers and they break the validation/calculation javascript.

-correct formatting, but cannot use value of field when validating/calculating with javascript
forms.FillField("Monthly_Ded_Amt1", FormatCurrency(Math.Ceiling(decimalVar)))
Hi Adrian,

Thanks for sharing the details.

I have tested the scenario and have managed to reproduce above stated problem. In my earlier attempt, I was using C# to test the scenario but when using VB.NET, I have managed to execute the code. For the sake of correction, I have logged it as PDFNEWNET-40713 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.