Automatic filling form from user-provided values

This Forum is for the use of End Users requiring help and assistance for Tracker Software's PDF-Tools.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
mbkyb
User
Posts: 2
Joined: Thu Sep 03, 2020 12:21 pm

Automatic filling form from user-provided values

Post by mbkyb »

We often have a set of forms for a single person, which need to be filled out, printed and signed.

I have managed to use PDF-Tools to fill the forms using a text file containing all the field values, but now I would like to prompt the PDF operator to provide these values.

In addition, some values such as a person's name are needed on multiple forms and obviously I do not want the operator to enter the name multiple times.

And I would like to avoid using another tool (autohotkey or similar) to create the text file.

So the question is: Is there a way in PDF-Tools to show a dialog to enter some values and use those values in a macro, for example?

Or could I create a helper PDF with form fields and a button, which would then launch PDF-Tools with those field values?

Thanks!
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Automatic filling form from user-provided values

Post by TrackerSupp-Daniel »

Hi, mbkyb

Thank you for the request, we do offer this, to some degree, though it is highly dependant on the User and the Form in question.
First I should explain how form fields work. The individual fields you see on the page are only "display areas" for the field, the field itself is not actually that object. Each of these fields have a name, and the value (what goes inside the field) is tied to that field name, you can in turn give multiple field objects the same name, and they will all show the same data.
As an example, See the Gif below, there I have 4 fields, The left two fields are both called "First name", on the Right I have "Last name" and "LAST NAME":
FLm0mcP2M7.gif
The fields are case sensitive, but if you have setup all fields which need the same value to have the exact same name, the process you need will be much simpler.

Following that, It will still be easiest for the user to navigate through the form to fill in the required information, but if you wish, you can create a CSV file with all the field names (case sensitive) along the top row. The user can then open this file in Excel or any other spreadsheet manager and fill in their details in the second row below each item. Like so:
image.png
image.png (3.13 KiB) Viewed 1885 times
With this in place, they can then use the "import form data" or "populate forms" functions on the Form tab in our software:
image1.png
This will allow them to import that data directly to the document. Do also note that if the CSV file and your documents are created with this method in mind, you could use a single CSV file to be imported to multiple documents. PDF-Tools also offers the "import form data" function mentioned above, so it could be used to automate this process nicely, as you have discovered.

You may also be able to make use of some advanced javascript to create a "form filling button" which would present a dialog box like you are asking for. After which it could then input the answers into the relevant fields, but this would be a very complex project as you would need to manually code the container for the dialog box and all questions yourself. Note that this method would mean PDF-Tools cannot be used, as it is unable to run Document JS like this.

For reference, this article should provide some useful details on how to make efficient use of form fields: https://www.pdf-xchange.com/knowle ... -PDF-forms

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Automatic filling form from user-provided values

Post by Vasyl-Tracker Dev Team »

Hi, mbkyb.

We discussed about this feature and decided to implement it in the near future. Thanks for the good suggestion.
Also, if you have more details about this scenario of usage - please provide it too. It may help us to do it better...

Cheers.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
mbkyb
User
Posts: 2
Joined: Thu Sep 03, 2020 12:21 pm

Re: Automatic filling form from user-provided values

Post by mbkyb »

Thanks for both messages!
From the first, I understand that we could use the PDF itself as form and ask the user to tab through the fields. If redundant field use the identical name, any data would be copied. Is that correct?
Regarding your second message: Great to hear you consider to add it to the product! Curious to see what you guys come up with!

For me, it would make a lot of sense to have an action that would produce a GUI form, and then the values of the form fields would either be stored in macros (more flexible), or be used as field name/value pairs for the downstream PDF.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Automatic filling form from user-provided values

Post by TrackerSupp-Daniel »

Hi, mbkyb
mbkyb wrote: Wed Sep 09, 2020 7:26 pm If redundant field use the identical name, any data would be copied. Is that correct?
Yes that is correct, so long as they have the same field name and are stored in the same document, they will both display the same value.

AS for the feature request, we are not certain yet exactly how this will be implemented, but it will likely be a while before it can be implemented.
When complete, It may appear as a dialog box, like you described, prompting the user once for each field name, across all selected documents. In that case if two documents both have a field named "First name" you would only see a single prompt. However it would likely also need to be case sensitive, so if the two documents, had slightly differently named fields (such as "first name" and "First Name"), those would be regarded as two separate fields and each recieve their own prompt.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Automatic filling form from user-provided values

Post by Vasyl-Tracker Dev Team »

We plan to tune the existing "Import Form Data" tool in PDF-Tools by adding a new option such as "Ask the user for values of form fields that are not listed in the data file" (as a simple checkbox probably). The user will be able to enable this option and run the tool, specify the bunch of pdfs as input - and the tool will open each pdf, find all form-fields that are not listed in the specified data file(txt, CSV, etc) and then ask the user for values for that fields via special modal dialogue. And yes, each field with a unique name will be asked only one time for the entire runtime of the tool. This means that the once entered value will be used automatically for all fields with the same name exactly in the whole collection of pdfs.

Is this acceptable to you?
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
dasy2k1
User
Posts: 65
Joined: Mon Feb 15, 2016 10:55 am
Location: Birmingham UK

Re: Automatic filling form from user-provided values

Post by dasy2k1 »

I would love a couple of basic script variables as PDF tools options, such as "Prompt for input" that displays an input box when a script is run that i could then use the stored variable (in %[VARNAME] format) in any other subsequent tool where i could use macros such as %[FILENAME]
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Automatic filling form from user-provided values

Post by TrackerSupp-Daniel »

Hi, dasy2k1

Thank you for the suggestion, Custom macros is something we have discussed in the past, but need to be sure how people envision them working before we make an implementation (since it will be very difficult to make any changes once it is implemented).

My vision of how it would work is something like this:
Say, for example sake, you have a set of documents which are generated every week with a unique "project identifier", because of the software used, you need to do some tasks after it is generated.
EG: Week 1, the Identifier is something like "project 1RC-52J", then in week 2 it changes to something like "project 25TC-5K", and so on for further weeks.
  1. You have a custom tool which does these tasks, for example, apply headers, Watermarks, and change the document name, all of these items need to use the exact same identifier number.
  2. Instead of needing to manually check all 3 actions in your custom tool, and make the changes there, you would like to use a custom macro, "%[ProjNum]" instead. This would then be make to equal whatever a given week's project identifier should be.
  3. Now, in any future weeks, you can go back and update the project number for that macro "%[ProjNum]" directly, and have it automatically take effect in all the tools which are already set to use it, without needing to individually check each one.
Based on most clients I have helped, this seems like it would be the most universally beneficial application, but if you have another way you envision it working, please let me know and we will contemplate the benefits.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
dasy2k1
User
Posts: 65
Joined: Mon Feb 15, 2016 10:55 am
Location: Birmingham UK

Re: Automatic filling form from user-provided values

Post by dasy2k1 »

Thats pretty much how i envisage it.

apart from i want to be able to prompt a non technical user to enter this data for me

when the user clicks run and chooses the input files for example they would get a box with
"Please enter Project Number" and an text entry box. (I would set up the message and the name of the variable in the detailed settings for the tool)
when they click OK on that the data is saved as a temporary variable for the duration of this script running

every time you run the script it prompts for this input and then uses this value for the rest of the script.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Automatic filling form from user-provided values

Post by TrackerSupp-Daniel »

Hi, dasy2k1

Sorry for the delay, I have created two feature requests for you on this end then. while you cannot look them up, you can certainly ask for updates here. I should warn you now though, these are both complex items which will not be quick to implement, do expect to be waiting a fair while before there is much for me to report.

RT#5430: Custom macros
RT#5431: "Prompt for input" macro


Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply