• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Acrobat PDF Form Design Inquiry

Engaged ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

If done properly using a combination of form fields, scripts, and arrays, is it possible to design an interactive PDF form to collect as well as display the data collected employing the same set of fields on the form or would it normally require two pages or two separate groups of form fields on the same page, namely one group or interface to add|collect the data and another to present it? Moreover, the form fields or interface used to present the data would act as a lookup based on a selection provided by a combo box. I hope this explanation is clear enough to solicit a 'yes' or 'no' answer. In essence, what I would like to do is to create a password manager that isn't contingent on generating a page for each name added to the form. For example, years ago I created a password manager using Acrobat whereby each and every name, vendor, website, etc. added to the form generated an additional page associated with a bookmark. Needless to say, performance suffered as names were added over time especially as the number of pages increased close to 100.  This noted, in creating a new password manager, my idea is to eliminate the need to add pages and generate bookmarks by using arrays to collect, store, and display the data using a 1-2 page PDF form. What are your thoughts if any regarding this subject matter? Thank you ahead of time.

TOPICS
Create PDFs , How to , JavaScript , PDF forms

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

yes.

 

 

 

[I was tempted to leave my answer at that]

 

There is no reason why you couldn't do what you want on a single page, I am not sure why one of the tools specifically designed for it would not be a better option. but you could do this in Acrobat.

 

you could have a selection of fields, which when an Add button is clicked updated the records ( more on this later)

Then you could have some kind of search functionality/drop down list to select the option, which then populates those same fields (probably want to add something to add functionality so you don't end up with duplicates.

The only real problem to solve would be how to save the data, but I guess this would work.  CreateDataObject, you could just add/remove entries on a file stored inside the PDF.

(See here for more info - https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_jsapiref.pdf)

 

Just a rough thought, would probably need refinement based onyour expected usage etc....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

I've built this type of functionality many times. I save the data in JSON so its easy to handle and can be accessed very quickly.  Using an attachment is a great idea. Except that an attachment cannot be updated from Reader. If you need this to work in Reader, then use a hidden text field to store the data.  

 

You could also build import and export scripts to put the data into CSV format for transfering  to/from Excel.  

 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

Thanks for the comments/suggestions. Upon further study the answer appears to be a resounding 'yes' whereby using a multidimensional array to collect, store, and display each record separately associated with the combo box selection works like a charm. All that remains are the fields to be created for adding new password records one at a time to the existing multidimensional array used to populate the combo box on the lookup page view. As such, a 2-page form appears to be the perfect design|layout whereby one page serves as a lookup and the other for adding a new password to the existing array used to populate the combo box in the lookup view. All considered, I prefer to keep everything in one PDF form as opposed to having to import|export scripts. As already stated, the lookup screen works like a charm. Once I am finished with the add-on page, if interested, I will let everyone know how it turns out. Needless to say, I am very optimistic thus far. I should also add that my current PDF file size that presently contains 22 records is well below 100kb, a far cry compared to my password manager form of old that employs a separate page for each password record along with a bookmark resulting in a 430kb file containing a whopping 80 pages/records. And lest I forget, the form also incorporates a custom popup menu including features|menu items such as 'Start Over', 'Highlight Fields', 'Add Record', 'Lookup Record','Print Selected','Print All', 'About', etc. that I have used countless times on other forms without issues. Your thoughts welcome. Screenshot attached of the lookup page for reference. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

For those interested, I decided to provide another screenshot of my password manager lookup page displaying data from a password record stored in the multidimensional array. Note that all fields don't necessarily contain|provide data as it depends on the record selected|shown on the page.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

Sorry to beat a dead horse to death but after all is said and done, I've come to realize that I could have simplified my initial post especially for those familiar with database programming that nomally requires a front and back end. In reality, for those of you who have been using Acrobat since it first debued back in 93, I believe Adobe provided a database driver, i.e. ADBC, to connect to a database, i.e., MS Access, to serve as a back end to a PDF form designed to serve as a front end. With this in mind, I should have initially asked if it was possible to design an interactive PDF form to serve as a front end dependent on a multidimensional array for a backend in lieu of a database. Also, if anyone is aware of a database that can be used as a backend for an interactive PDF form, I would be most interested as well. Thank you ahead of time.    

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

In case this is still an issue: ADBC was removed many, many years ago and was not replaced. Acrobat cannot be used in the conventional way as a database front end. It can connect to web services, and so a client-server model may be possible. Be very careful if you want to deploy with Reader, there are many specific limitations to encourage everyone to buy Acrobat.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

Thom, I just wanted to thank you for the tidbit regarding JSON in which event  I had since taken some time to read and learn what I could about it. Needless to say, I'm glad I did since on the surface JSON appears to be exactly what I need to create a PDF form able to collect, manage, and view information stored in multidimensional arrays. In reality, while multidimensional arrays work fine for presenting data, I've since run into issues for adding/editing data to the PDF form. As I understand JSON to be a data exchange format similar to a text file. and that I need this to work in Reader as well, am I correct in interpreting your suggestion regarding the hidden text file as a JSON file embeded in the PDF form meaning the file doesn't have to be installed on a server? Also, as I have searched the internet high and low, do you know where I might find an example script or tutorial to show how to use JSON in a PDF form? Thank you ahead of time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

At it's simplest, JSON is just JavaScript text.  Don't make it too complicated.  To save your big array of data, just convert it to text.  

 

var strMyData = myArray.toSource()

 

Then "strMyData" can be stored in a text field or an attachment. BTW, "toSource()" is the legacy function for converting any JavaScript entity into source code.  It only works with generic entities. If you don't care about backwards convertibility, you can use the new JSON object to do the conversion.

 

var strMyData = JSON.stringify(myArray);

 

When the data needs to be reconstituted, use the legacy "eval()" function;

 

myArray = eval(strMyData);

 

or the JSON function

 

myArray = JSON.parse(strMyData);

 

 

So the legacy functions do not produce true JSON, which has a specific format. But it doesn't matter because the data isn't being transfered to another system where the specific JSON format it required. The important bit is that a data object (like your array) can be converted directly to text and reconstituted directly from text with no intervening steps.  

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

You might also find the example in this article helpful:

https://acrobatusers.com/tutorials/list_and_combo_in_lc/

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

Thom. Thank you for all the feedback. In reference to my initial post , having already spent countless hours trying everything I can think of to collect, store, view, and keep all the data inside one PDF form using a multidimensional array and only two views|pages to essentially lookup, add, and edit password records for different and an unlimited number of names|vendors, I believe I could have easily accomplished this and more if only the addScript and setAction JS methods were supported in Acrobat Reader. Point is, in my particular case I really wanted to be able to add, edit, delete, and view all records in a PDF form using the free Acrobat Reader without having to use and rely on generating additional pages|records using templates. Too bad the methods I previously referred to aren't supported in the Reader. Oh well, wishful thinking at best.   

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

LATEST

A technique I've used successfully many times, is to save data to a hidden text field.  You can save a lot of text data to a field.  

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines