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, Sean - Tracker, Chris - Tracker Supp, 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 » Thu Sep 03, 2020 12:30 pm

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: 3800
Joined: Wed Jan 03, 2018 6:52 pm

Re: Automatic filling form from user-provided values

Post by TrackerSupp-Daniel » Tue Sep 08, 2020 6:11 pm

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 149 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.tracker-software.com/knowle ... -PDF-forms

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

Support: <Support@tracker-software.com>
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 1991
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Automatic filling form from user-provided values

Post by Vasyl-Tracker Dev Team » Wed Sep 09, 2020 6:54 pm

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 » Wed Sep 09, 2020 7:26 pm

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: 3800
Joined: Wed Jan 03, 2018 6:52 pm

Re: Automatic filling form from user-provided values

Post by TrackerSupp-Daniel » Wed Sep 09, 2020 8:00 pm

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,
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Support: <Support@tracker-software.com>
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 1991
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Automatic filling form from user-provided values

Post by Vasyl-Tracker Dev Team » Wed Sep 09, 2020 8:16 pm

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.

Post Reply