These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

An "Attach a File to the document" script

GETIguy
Registered: Jun 21 2007
Posts: 2

I am using Acrobat 8 Pro and LiveCycle Designer 8.0
Is there a a way to write a script to allow the user to attach an image file? Could this image file then be collected along with the form data when the document is submitted via email? This would be for users opening the doc using Reader.
 
-What I am trying to accomplish is for a user to receive the document, answer a few survey questions, and click a button to attach their own image file to the doc. Then when they hit submit, the form data is returned along with the image file. I would rather add a scripted button than rely on the user to use the built in attachment method.

My Product Information:
Acrobat Pro 8.0999999999999996447286321199499070644378662109375, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, this is possible with a little used form field feature in Acrobat JavaScript. It will not work for LiveCycle forms.

Here are the steps:
1. Create a text field
2. In the Properties dialog check
- Scroll Long Text
- Field Used for file selection
3. Add this "MouseUp" Script to the field

event.target.browseForFileToSubmit();

When the field is clicked a File open dialog will be displayed. The selected file will be submitted with the form data.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

thea_ls
Registered: Oct 24 2007
Posts: 12
I am trying to do this same thing. I see Thom's answer, but I can't find where to do this aT. Thom said it can't be done for LiveCycle forms - does this mean you have to recreate the form somewhere else, or just that you can't do it on your form from LiveCycle?

Also, sorry to sound so lost, but what is Acrobat JavaScript, is it a program? I can't find any information on it. I am also using LiveCycle and Acrobat Pro 8...and I am having problems with being able to have an attachment button.
thea_ls
Registered: Oct 24 2007
Posts: 12
I figured out how to do everything Thom said to do but when the Open Dialog box is displayed and I choose a file, the data is not attached...the field does show the file name, but that's it. Did anyone else get this to work?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The file is not attached to the PDF. This methodolgy is for attaching a file to the data sent on a submit. The data format must be FDF.

Attaching a file to a PDF is a different thing.

Take a look at this post for more info
http://www.acrobatusers.com/forums/ask_an_expert/questions/view/3626/

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

thea_ls
Registered: Oct 24 2007
Posts: 12
Hi Thomp,

I'm unable to see the whole link you provided. It got cut off due to its length. :(
thea_ls
Registered: Oct 24 2007
Posts: 12
Nevermind I found it in the source code :)