Free Support Forum - aspose.com

Modifying form fields

I am trying to set text into form fields. However, sometimes the text is a little to long and gets clipped. I would like to change the font size of the field to accommodate the text. I cannot find a way to do that. Is is possible?

Hi Nat,

You may use decorateField method of FormEditor class to set the attributes of the form field including font size with the help of FormFieldFacade class.

I hope this helps. If you have any further questions, please do let us know.
Regards,

I saw the method decorateField but I can't figure out how it works. You can specify a field but how do you specify the attributes you want to change? Is there an example you can point me to?

Thanks

I found a .NET example but I'm using the Java version. However, It looked like it should work the same way so I tried it. Everytime I call decorateField the entire field disappears.

Here is what I'm doing:


FormFieldFacade fff = new FormFieldFacade();

FormEditor editor = new FormEditor(inPath, outPath);

editor.setFacade(fff);
fff.setFontSize(8);
editor.decorateField("My_Field");
editor.resetFacade();
editor.save();

What is wrong?

Hi Nat,

Your code looks fine. Could you please share the input PDF file with us, so we could test the issue at our end? You’ll be updated with the results accordingly.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

Is there a way to send you the pdf privately? I am not allowed to openly share it. On a side note I tried to modify the text size using iText and it works fine so I'm thinking the pdf is OK. However, if you can get it to work in pdf.kit it would be better for me.

Nat

Hi Nat,

You may use the option ‘Contact - Send shahzad.latif an email’ option at the top of this post to send the PDF file. Also, if the thread is marked as private, the file will be accessible only by the Aspose staff. We’ll investigate the issue at our end and help you out accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Nat,

I have reproduced this problem at my end and logged it as PDFKITJAVA-28773 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,