Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Monday, June 3, 2019 8:28:19 PM(UTC)

Rank: Member

Groups: Registered
Joined: 5/9/2019(UTC)
Posts: 17
Location: Sydney

I want to be able to change the font size of input text dynamically when the entered text reaches the end of the input rectangle.

For example, if i change the DA (default appearance) from "/Helv 10 Tf 0 g" to "/Helv 0 Tf 0 g" - the font size will automatically resize when the end of the input rectangle is reached.

However, i would like to update the DA to auto resize the font - only when the text reaches the end of the input rectangle, rather than by default on the input field (BEFORE it has reached the end). In order to do that i need to know the SelectedField Value as the user types text.

The Document (PDFDocument), contains a SelectedField (PdfField) - as the text is entered into a field, the Value is NOT updated. Rather the Value is ONLY updated once the context is lost on the input field.

1. Is there any support to only resize the default appearance, setting the font size to '0' once the text has reached the end of the input rectangle?
2. Or is it possible somehow to determine when the end of the rectangle has been reached by the input text?
Paul Rayman  
#2 Posted : Tuesday, June 4, 2019 12:13:14 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 789

Thanks: 1 times
Was thanked: 98 time(s) in 96 post(s)
Unfortunately there is no something like ValueChanging event.
I can suggest a workaround only: inside PreviewKeyDown handler check if acroform is focused then store and analize the user input.

For check if acroform has been focused you may try to use FillForms.FocusChanged event, or both FocusChanged and FillForms.Invalidate.
The same technique used here: https://forum.patagames....licked-form--acro--field
#3 Posted : Tuesday, June 4, 2019 6:03:54 PM(UTC)

Rank: Newbie

Groups: Registered
Joined: 6/3/2019(UTC)
Posts: 1
Location: NSW

Thanks for the response Paul.

We did look at the key and focus events, and while they may initial seem to solve the problem, it has some limitations such as when the user uses the mouse or shift+arrow keys to highlight text and then hits the delete button, ctrl+x, ctrl+v, etc ... keeping track of the actual value will be pretty cumbersome and highly error prone.

Ideally it would be nice is something in the pdf library could expose the 'editing' value on the field. Do you know if there is anything now or in the future where this is possible?


Edited by user Tuesday, June 4, 2019 8:39:00 PM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.