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

I want to look up data from an external file and use it to fill an acrobat form field

New Here ,
Aug 10, 2018 Aug 10, 2018

I'm working on a travel form pdf and want to look up the travel distances in an external Excel spreadsheet (or cvs, tab-delimited text file, etc.).  All I've found on this is creating an array or table in the pdf to search using javascript.  That seems rather arduous given the number of cities in a given state.   Any help here is appreciated.

Thanks,

Randall

TOPICS
PDF forms
2.2K
Translate
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
1 ACCEPTED SOLUTION
LEGEND ,
Aug 11, 2018 Aug 11, 2018

Reader is not able to use most of the methods that Acrobat can to access data in external files, but it can read data in file attachments. So you could include a data file (e.g., tab delimited text) and read it using the doc.getDataObjectContents JavaScript method. This keeps the data with the document that uses it, so it's a portable solution. It could be rather slow depending on how much data is involved.

An alternative is to have each user install a folder-level JavaScript file that simply contains the data, similar to how you could by including it in a document. This approach would be faster than the previous one. It isn't really portable since each user would have to separately install the file, but the single data source would be readily available to any number of forms once it's installed.

View solution in original post

Translate
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 ,
Aug 10, 2018 Aug 10, 2018

Does it need to work with Reader?

Translate
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
New Here ,
Aug 11, 2018 Aug 11, 2018

Yes.

Translate
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 ,
Aug 11, 2018 Aug 11, 2018

Reader is not able to use most of the methods that Acrobat can to access data in external files, but it can read data in file attachments. So you could include a data file (e.g., tab delimited text) and read it using the doc.getDataObjectContents JavaScript method. This keeps the data with the document that uses it, so it's a portable solution. It could be rather slow depending on how much data is involved.

An alternative is to have each user install a folder-level JavaScript file that simply contains the data, similar to how you could by including it in a document. This approach would be faster than the previous one. It isn't really portable since each user would have to separately install the file, but the single data source would be readily available to any number of forms once it's installed.

Translate
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
New Here ,
May 05, 2023 May 05, 2023

Do you know the limits of the amount of data using the CSV method you describe.

Let call the limit lines of text in an excel file...

 

20,000?

100,000?

 

before it gets slow?

I want to import a catalog of products that is quite large.

 

Thanks

 

Ryan

Translate
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
New Here ,
May 05, 2023 May 05, 2023

@REMZilla see question above - thanks

Translate
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
New Here ,
May 05, 2023 May 05, 2023

@George_Johnson - see question above - thanks

Translate
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 ,
May 06, 2023 May 06, 2023
LATEST

There's no way of answering that, as it depends on many factors.

A script can read a CSV file in milliseconds, that's not the issue. The problem is what you then do with that data. If you use it to populate a drop-down with 20K items it's going to be a nightmare to use it.

Translate
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