cancel
Showing results for 
Search instead for 
Did you mean: 

Adobe Form : Dynamic font size adjustment

Former Member
0 Kudos

Hi Team,

My Client came up with strange requirement. i have a text field in Adobe Form which is having a limited Character length and i am filling up with SAP PO and External PO number. External PO number vary in length. As of now if the length is large than the Text Field size in Adobe Form, i am giving multiple Lines which means It will show SAP PO number above and External PO number Below.

My client wants : Adjust it in such a way that both will come in same line, and if length increase it should reduce the font size but should display in single line only.

Is it Possible to reduce font size at run time if length of characters is more?

I think its quite not possible, but still want to check with experts

Any suggestions?

Regards,

Arpit Varma

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Arpit,

I have some way to do this.

1. Lets say your current font size is "10".  Count the max number of characters that are possible with this font size without line break. You can use the java script command String.length.

2. If the number of characters exceeds the maximum characters, then set the smaller font for that text field using the java script TextField.font.size = "8".

3. You can do this for dynamic font size depending upon the max number of characters for each font size.

Hope you got my point. Please let me know for further help.

Regards,

Mahidhar.

Former Member
0 Kudos

Hi Mahidhar,

You are correct, i thought of this solution but i am not aware of java scrip or FormCalc.

Could you please provide a bit of code so that i can apply it to script editor and try my luck.

Thank You.

Regards,

Arpit.

Former Member
0 Kudos

Hi Arpit,

For getting string length for external PO, use below java script code:

var len;

len = externalpo.length;

For setting font size for that externalpo test field use :

externalpo.font.size = "8";

i am taking lengths for example 20, 30 and 40 where line break is happening. Select your external PO number on layout and write the following java script:

if (len == 20)

{

     this.font.size = "8";  

else if (len == 30)

{

     this.font.size = "6";  

else if (len == 40)

{

     this.font.size = "4";

}

Please let me know if u r still facing problem.

Regards,

Mahidhar.

Former Member
0 Kudos

Hi Mahidhar,

My problem is solved in other way, but thank you so much for the information.

Regards,

Arpit.

Former Member
0 Kudos

Hello Arpit,

Could you please tell me, what was that other way. I am also facing same problem and above coding is not working. Also, I am trying to find out feasibility of dynamic font in adobe form without using java script. So, let me know is there any other way or not. Thanks.

Regards,

Bhushan Agrawal

Former Member
0 Kudos

Hi Bhushan,

Customer actually agreed on different approach for the above scenario. So I did not do the above change actually. Also, as far as I know, you can not achieve the above requirement without javascript/formcalc.

Regards,

Arpit Varma.

Answers (2)

Answers (2)

0 Kudos

Hi Aprit,

The solution with script is no good solution for the customers. If you have multiple characters and a very small font-size the form will not be used by the customers.

Your Customer should use 2 lines, because the print-out is maybe not readable at your script.

Hopfefully you find the correct solution,

Regards,

Jeremia Girke

former_member225688
Participant
0 Kudos

Hi Arpit,

If this is really urgent you can try creating multiple forms with different fonts set and depends on the External PO number you can call the form with smaller and larger font size.

Hope this will help you as i believe this is the simplest way to achieve this.

Thanks

Dnyan