Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Does it need to work with Reader?
Copy link to clipboard
Copied
Yes.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
@REMZilla see question above - thanks
Copy link to clipboard
Copied
@George_Johnson - see question above - thanks
Copy link to clipboard
Copied
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.