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

How can I use Javascript to transfer data from 1 PDF to a different PDF if a field contains specific text.

Community Beginner ,
Nov 03, 2017 Nov 03, 2017

I am working on a proof of concept and the files in the link below are setup to try to achieve it.

Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.

The "Text Field to search for unique IDs.pdf" has a javascript that populates todays date when opened. It has another text field named "search" What I want to happen is if a user types Cat in the search text field then a javascript will transfer the date into another PDF (Cat.pdf). I also want if the user types Dog that it  transfers the date into another PDF (Dog.pdf) And of course if the user types both Cat & Dog into the field that it transfers the date into both the Cat and Dog PDFs

The files must be PDF and will reside on a local machine in the same directory.

Any assistance you can provide would be very appreciated. Thanks in advance!

TOPICS
Acrobat SDK and JavaScript
610
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 Beginner ,
Nov 03, 2017 Nov 03, 2017

Or is it not possible?

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 ,
Nov 03, 2017 Nov 03, 2017

You can programmatically populate fields in other PDF files as long as those files have their "disclosed" property set to true. Which means you'll need to have some JavaScript added to the target files as well as your source document.

Your UI seems problematic to me though. What happens if the term that gets typed in doesn't have a target of the same file name?... or they type in "cat" instead of "Cat". You may want to redesign the source document so that you use a listbox that can have multiple selections and those selections are limited to the files in the directory.

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 Beginner ,
Nov 06, 2017 Nov 06, 2017
LATEST

If this gets resolved the input is actually going to be done by scanning barcodes into the "search" PDF so there would be no need to worry about the appropriate syntax being used as it would already be established and not rely on user input.

A drop down menu would not be good to use as there will be 100+ options and it would take longer to search for the correct attribute from the drop down menu. I am attempting to automate a series of handwritten forms to speed up the process of issuing devices. The search file is for capturing the device and the cat and dog files are for tracking the individual device usage.

I can easily add a script on the local machine as you mentioned but the scripting to make these forms communicate back and forth is where I am getting stumped. If you can point me to a resource or provide an example I would be very appreciative

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 ,
Nov 03, 2017 Nov 03, 2017

In addition to what Joel already said, the script will have to be installed on the user's local machine for it to work.

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 ,
Nov 03, 2017 Nov 03, 2017

True... though, now that I think this through a bit, you could solve three problems by attaching the targets to the source file rather than have them floating about in the same folder.

1) You wouldn't need a trusted function in a separate .js file to open the attachment

2) You'd know which files were available to open

3) The documents wouldn't need to be disclosed. (Not sure on that one... I have the memory of a gold fish... but it's easy enough to test)

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