• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

JavaScript Code for Attachment, Text Field & Clear files Button

New Here ,
Mar 29, 2019 Mar 29, 2019

Copy link to clipboard

Copied

Good day, Is it possible to get the Java script code to add attachment(file), Text field to show the file name that was attached  and the Clear files button to clear the text field and remove attachment. This is what i am looking for on the form i am trying to create. Any help would be greatly appreciated. Thanks

TOPICS
Acrobat SDK and JavaScript , Windows

Views

287

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 ,
Apr 02, 2019 Apr 02, 2019

Copy link to clipboard

Copied

LATEST

Yes and no. The code for adding an attachment is this:

this.importDataObject("TheObject");

This prompts the user with a file open dialog.  The name "TheObject" is the name of this attachment.

use this code to remove

this.removeDataObject("TheObject);

I've already answered a question about showing the attachment name here:

HelIo, I have an Attachment button but I would like the attachment name to show in a text box. The a...

Be aware that importing a data object can be a privileged operation, and that this code will only work in Reader if the PDF has special privileges.

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