Forum for the PDF-XChange Editor - Free and Licensed Versions
Moderators:PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
I'm having trouble with two aspects of text fields and hope someone can help me:
1. When a text field is active (ie selected and typing in the field), it seems like PXCE does not accept adding a "Keystroke" action to it. It always has to be deselected before the action will take. Is there a way around this? Is this the same in other PDF programs?
To reproduce, select a text field, then run in the console (assuming the text Field Name is "Text1"):
Now start typing in the field. Expected is that it would output what's being typed to the console log.
2. This brings up the second and most difficult issue for me: Is there a way to know what is currently in the field? event.value contains the value before the last keypress. event.change sometimes has what the last keypress was - but it's not useful for two cases: backspace returns nothing, or if the keypress is somewhere in the middle of the text in the field (ie inserting text).
I am not sure it is not accepting added keystrokes but rather it is accepting the keystrokes but you just cannot see them. If you go into the Page Contents Properties (whilst the text is selected), you may find that 'Fill Color' is 'None'. Change that to something that would be visible and see if that changes anything for you.
PHK wrote: ↑Thu Aug 28, 2025 11:10 am
I am not sure it is not accepting added keystrokes but rather it is accepting the keystrokes but you just cannot see them.
I’m sorry I wasn’t clear: if the field is active (ie I’m typing in it already), when a script tries to add a “Keystroke” event (“action“) that event will not fire*. I can still keep typing in the field and it shows up fine in the field, it’s just not generating the key press events.
* probably because PXCE looks at the actions before the field is active and once it’s active PXCE is already cycling through the field events.
TLDR: The reason I’m off on this tangent is I’m trying to make a script that adds events to a field on the fly but only to a field that’s currently selected. Reason for that is I wanted to remove the Keystroke event immediately after the field is deselected instead of trying to clean up before the file is saved. At this point I’ve pretty much given up on that direction and am adding the events in advance and using a willclose event to clean up. If there was a way for a script to know the value of a field as it’s being typed in without using the Keystroke event all this would be mute but I don’t think there is.
I have passed this up to the Dev team for review (hopefully they can find the time to pop in here and give us some information).
Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
I’m sorry I wasn’t clear: if the field is active (ie I’m typing in it already), when a script tries to add a “Keystroke” event (“action“) that event will not fire*. I can still keep typing in the field and it shows up fine in the field, it’s just not generating the key press events.
...
Ah, I had a sneaking suspicion that your question, Mathew, was on a higher plane than was my answer and that, as usual, I was a bit out of my depth. Let's hope DevTeam can help you out on this one to continue your very productive enhancement activities.
Dan McIntyre - Support Technician
PDF-XChange Co. LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com