Fill PDF field with format

Hello,

I want to fill fields in an PDF File which are formatted as number.
With the method “FillField” I can input only a string, and even if the string is in the right format the field in the PDF change the format, so that its not the right.

Is it possible to get or set the format of the field?

Regards
Ringo

Hi Ringo,


Thanks for your inquiry. You may use AFNumber_Format function for field formatting. Please find a sample code snippet for the purpose. Hopefully it will help to accomplish the requirements.

<o:p></o:p>

<o:p> </o:p>

Document doc = new Document(“input.pdf”);<o:p></o:p>

TextBoxField field = doc.Form[“textField”] as TextBoxField;<o:p></o:p>

field.Value = “1200”;<o:p></o:p>

field.Actions.OnModifyCharacter = new JavascriptAction(“AFNumber_Keystroke(2, 0, 1, 0, “$”, true)”);<o:p></o:p>

field.Actions.OnFormat = new JavascriptAction(“AFNumber_Format(2, 0, 1, 0, “$”, true)”);<o:p></o:p>

doc.Save(“out.pdf”);<o:p></o:p>

<o:p> </o:p>

<o:p>Please feel free to contact us for any further assistance.</o:p>

<o:p>
</o:p>

<o:p>Best Regards,</o:p>

Thank you for your answer. I tried it in the latest version Aspose.Pdf for .NET 9.3.0 but it works only partly.
I can see the format and it seems like I can change it, but not really. I can change the format of the displayed value bt not the original format of the textbox.

In my case I just want to delete the format, so that I can put the right string by myself. So I set OnFormat to null. The value is displayed correctly, but if you later still want to edit it manually the original format of the textbox, which is still there, changes the format, unfortunately to another format (point and comma are mixed up). So I still cannot use it.

Document doc = new Document(“05_Vollversicherung.pdf”);

TextBoxField field = doc.Form[“P1_TB”] as TextBoxField;
field.Actions.OnFormat = null;

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(doc);
pdfForm.FillField(“P1_TB”, “2,45”);

As attachment I send you the pdf file if you want to test it. I want to fill the fields “Monatsbeitrag in EUR” at page 2.
Do you still have an idea.

Regards
Ringo

Hi Ringo,


Thanks for your feedback. After initial investigation, we have logged your requirement as PDFNEWNET-37119 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,