Installation
Download the zip file, extract and copy to the Javascripts folder, and restart PDF Change. See viewtopic.php?p=196006#p196006 for more detailed instructions.
Features
- When enabled, it will remember anything typed into text fields, and offer that in future suggestions.
- Document specific autocompletes: If there is a list of possible autocompletes that are specific to a document, those can be saved with that document.
- Default autocompletes: A list of default autocomplete values can be saved either in the application folder, or in the user settings folder.
- The tool can be switched off generally and enabled on a document as needed.
The tool adds three items to the Forms ribbon or menu: When one starts typing in a form text field, it will offer a list of past form field entries that include the text typed so far. Click on one of the suggestions to fill that into the form field:
Using a popup menu: (default setting - shows wherever the mouse pointer is) Using a form listbox: (shows immediately below the form field) When the tool is first installed, unless a list of default autocompletes has also been installed, there won't be any saved values; either edit the saved values list, or use the tool entering data into form fields.
Autocomplete Settings
- Start autocomplete when application starts starts a background interval that checks any open documents for text fields every half second. If it finds text fields, it adds a Keypress action to offer text suggestions as you type in the field. Turn this off to stop the tool from running automatically.
Max autocomplete rows limits the number of rows of suggestions to offer
Use a Form Listbox if checked it will temporarily add a dropdown form element below the active text field. Watch out: If you don't have a registered copy of PXCE Plus, you may get watermarks on the document if you use this option! By default, it's unchecked, and you'll get a popup menu wherever the mouse pointer currently is.
Form Appearance This is the appearance of the form dropdown.- Color… opens a separate dialog to edit the colors used in the form.
Timeout is the amount of time the dropdown stays visible while there's no typing in the text field.
Edit Saved Autocomplete Values This opens a separate dialog where you can edit the saved autocomplete values or document specific autocomplete values.-
Document Specific Autocomplete
The popup menu at the top allows you to select document specific autocomplete values (ie these will be saved with, and show up only for, the one document). Start on Load If document specific list is showing, there's a button to add a script to start autocomplete on the current document when it loads, even if the tool is set to not load automatically. It adds the following startup script to the Document Properties > JavaScript:Code: Select all
"object"===typeof autocompleteDD && autocompleteDD.addKeystrokeAction(this);
- Color… opens a separate dialog to edit the colors used in the form.
- If the background process is switched off, you can still use autocomplete by picking this menu item. It will add the Keypress actions to the current pdf. When you save the document it will try to clear the actions.
If the document is locked, you need to manually remove the actions (it will show a reminder in the lower right corner for locked pdfs).
- When the script adds the Keypress actions to the document, it also adds a "WillSave" action that tries to clean up all the actions when the document is closed. However, it can get tripped up or be prevented from adding the WillSave action on locked pdfs, so this menu item clears everything manually.
Limitations
- The script adds "Keypress" actions to text fields, and a "WillSave" action to the document. Because javascript has no way of knowing if a script was already applied, it will overwrite "clobber" any script on those actions.
- There's no way (as far as I know) for a javascript to know what the contents of a field is while a user is typing in it, without adding keypress actions directly to the fields in the document. Hence all the rigmarole trying to remove them afterwards: I use the 'WillSave' action to remove all the Keypress actions added to form fields immediately before the file is saved. Hopefully this results in the saved file never having Keypress actions saved with it. It sets a timeout to re-add them after the save.
- If the document is locked for editing, the script cannot add Close or Save actions to it. It will pop up a progress dialog in the lower right to remind you to clear the Keypress actions (just close it to clear them). It may be a bug, but PXCE is allowing Keypress actions to be added to a locked document by a menu item -- and has since at least version 9. This tool relies on that, so if at some time this window closes, the tool will no longer work on locked documents.
- There's not currently a way to set where a popup menu shows up. It's just placed wherever the mouse is currently. This can be a bit annoying if the mouse happens to be over the field when you start typing. I've made a feature request for this, but for now, move the mouse away from the field before typing in it.
- Fixed v1.1:
When enabling the background process, if a document is open PXCE will associate the process with that document and cancel it as soon as the document is closed. I don't know how to work around this, so added an alert when the checkbox is enabled.
For PDF XChange build 393 onwards, the only file that needs to be installed is autocompleteDD.js
If you don't need the ability to edit the form listbox colors, you can omit xutil.colorUtils.js
1ang.js is required by colorUtils and any translations. The translation strings are in the file below:
Translations
As of v1.0 it's translatable. Here are the translation strings (there are currently no translations)