Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

How to get visible text length from text field and cut off extra characters?

Avatar

Level 1

I've been trying to solve this problem for two days now with no luck. I'm newbie in this world. I'm using ADOBE LIFECYCLE DESIGNER ES4 for SAP.

My problem is that I have small price tags that I want to print to one A4 size paper. 2x5 labels in two rows. I have values coming from database and I print several sheets.

It actually doesn't matter what happens before the form but the problem is that some of the database values are like 1080 characters long but size of text field is smaller. Only visible area of the text field should be printed to output PDF and all text should end with character "+".

If this "+" doesn't show I know that the actual data is too long and I should get some sort of info that all my text didn't fit in to this area without going through all printed labels. All characters outside the visible area should be cut off completely so I can check if text printed on label is ended with "+".

I can't just cut off text after f.ex. 255 chars because chars are different sizes and the amount of visible chars may vary.

I have allowed multiple lines and limited length to visible area and hoped that the useless part of text would be cut off but if I read data from my script then I get the whole text and I don't know if it fitted to visible part of the text box.

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can't determine by scriptings if a fields value is too large for the fields visible area. There is simply no property in the field widget available that will inform you when this happens. The only information is the visible plus sign [+] in the fields corner. 

The available methods (such as "limit to visible area") to prevent of too long data to being entered are only working for inputs done by a user BUT NOT when done by scriptings or data loadings by the PDF viewer.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

You can't determine by scriptings if a fields value is too large for the fields visible area. There is simply no property in the field widget available that will inform you when this happens. The only information is the visible plus sign [+] in the fields corner. 

The available methods (such as "limit to visible area") to prevent of too long data to being entered are only working for inputs done by a user BUT NOT when done by scriptings or data loadings by the PDF viewer.