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

Importing .txt script working... but not at all.

New Here ,
Jul 20, 2023 Jul 20, 2023

Hi all,

 

I also take time to check to see if my question has been answered but I cannot find anything that matches the issue that I am having.

 

I am using this:

this.importTextData();

 

to prompt the user to select the .txt file to import into a fillable pdf document. There are no errors that appear and by the looks of it it works fine. However no data actually imports. Here is the strange thing, if i do the import process manually (Prepare Form -> More -> Import -> change to text files (*.txt) and select the exact same file I tried to in the this.importTextData(); process it works with out any issues and all the data imports.

 

So I know it is not an issue with the .txt file and that the Text Field Properties Names are fine. Is there something that is wrong with the "this.importTextData();" that is incorrect? 

 

Any help would be great. Thanks all in advance. 

TOPICS
JavaScript , PDF
447
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 ,
Jul 20, 2023 Jul 20, 2023

Where do you use script?

It needs to be run from privileged context.

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 ,
Jul 20, 2023 Jul 20, 2023

Thanks Nesa for the prompt reply.

 

I have it in a button on the pdf fillable form. This could very well be the issue.

 

Is there an easy fix?

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 ,
Jul 20, 2023 Jul 20, 2023

Look at the Javascript console (ctrl-j).

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 ,
Jul 21, 2023 Jul 21, 2023
LATEST

Are you testing it in Acrobat, or in Reader? For the latter a special right has to be applied to the file first, which I don't believe you can do with just Acrobat.

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