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

Selected file will not attach to PDF

GWilson53
Registered: Sep 2 2008
Posts: 11

I am a new user of adobe tools. I am using Acrobat 8 Pro in a Windows XP environment. I orignally designed the form using LiveCycle Designer but discovered that it would not work in my environment (users with Reader need to use my form).
Redisigned the form in Acrobat 8 Pro. I have it working with the exception of the file attachment process. I used a suggestion that I found in your forum( http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=6993) to use a text file that had been 'set for file seletion' and the script for browseForFileToSubmit(). When I click in the field, I get the expected file selection box. I select the file I want and the file selection box goes away (as expected). The text field associated with this script remains empty until I remove focus from it (i.e. click on another field). I can deal with this but the bigger problem is that I do not have the file attached to the pdf when I press the submit button later in the process. The submit button is an email submit and works fine to send the pdf form (but there is no attachment). It will not even work when I fill the form in using Acrobat 8 Pro.
Any ideas about what I am doing wrong?
Thanks

My Product Information:
Acrobat Pro 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The "Submit File" field setup you have described will only work when data is submitted from the form as FDF. When Acrobat builds the FDF data to submit it includes the raw file byte data into the FDF.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

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

GWilson53
Registered: Sep 2 2008
Posts: 11
Thanks for you quick reply but now I am more confused than ever. I am sure that my confusion comes from my inexperience and all the forum reading that I have done on this subject in the past few days.

From reading a forum entry from November 2007(see excerpt below), I thought that you had defined a process that would allow a file to be attached to a PDF form and submitted via email. What am I missing?

Here is the excerpt form this forum in November 2007:

ExcelGeek submitted this question:
How would you do this using a submit button using the PDF Format instead of using FDF? Plus doing it in Acrobat 8.0 pro instead of LiveCycle?

Your reply was:
There is a mechisim for this in regular PDF submissions. In fact it's been around for quite a while.

1. Add a text field to a PDF.
2. Name it "SubmitFiles"
2. Set the "Field is used for file selection" Option
3. Add this script to a mouse down action on the field, or to the submit button, just make sure that the script is called before the submit happens.

Code:
var f = this.getField("SubmitFiles");
f.browseForFileToSubmit();

Thanks in advance.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Files can only be embedded into a PDF from Reader if the PDF has special "Reader Rights Enabling" and the code for doing the embedding is run from a privileged context. Or the user can do it manually.

The only other way to submit a file from a PDF is to use the "submit file text field" mechanism already outlined.

Adobe has made the Acrobat/PDF environment very secure. It's probably the most secure application out there. In order to do this they have placed pretty heavy restrictions on how a PDF can interact with the local system.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

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

GWilson53
Registered: Sep 2 2008
Posts: 11
I fear that I have not been clear what my problem is.

I have created a form using Acrobat 8.1.2 that contains a text field that has the 'submit file text field' mechanism detailed in your 2007 forum entry.

When I try to test the form using Acrobat 8.1.2, the file select screen comes up and I select the file and when I remove focus from the field, the filename appears in the field. Everything seems to be working.

When I use the submit button to email the document, the PDF file is emailed but the attachment is not there.

Everything works as I would hope it would except the file is not attached.

Thanks again of trying to help me understand
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If the submit button is setup to email the entire PDF, then the 'submit file text field' technique will not work. This technique only works if the form data is submitted as FDF.

To solve the issue with the file path not being displayed until you click off of the field, add a button to the form. Place it right next to the submit field and put the "browseForFileToSubmit()" script into the mouse up action on the button.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

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

GWilson53
Registered: Sep 2 2008
Posts: 11
OK. I started from scratch (again).

I created a MS Word document with my headers in it.
Converted it to PDF.
Opened it in Acrobat 8.1.2.

Added a text field named SubmitFile
On the option tab, I changed it to SCROLL LONG TEXT and FILE IS USED FOR FILE SELECTION
On the Action tab, I added a Mouse Up/Run JavaScript event with the following code:
var f = this.getField(“SubmitFile”);
f.browseForFileToSubmit();

I added a button named Submit with a Mouse up/Submit a Form event
Edited the Submit a Form properties as follows:
url is mailto:myaddress@mydomain
export file is FDF include: Field data, comments, incremental changes to the PDf (all checked)
Field selection = all

I added one other text field (Name)just to have some other data to send.

I opened the form using Acrobat 8.1.2
Entered the name field
Clicked on the SubmitFile field and the Select File box opened (as expected)
Selected a file from my harddrive and clicked the SELECT button.
The File Selection box closed (as expected)
I removed focus from the SubmitFile field and the path to the selected file appeared in the SubmitFile field (as expected)
I clicked the Submit button.
My email client (GroupWise) opened an email send screen with the FDF file attached (as expected)
I sent the email but when I opened it, the SubmitFile field is blank and there are no attachments

Apparently, I am still missing something.
I am running out of time on this project. IF this can not be done using Acrobat, I need to move on to another tool.
Thanks
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Actually, you've completed the front end of the process. The form part is done. If you go back to my first post, I explained that the file byte data is encoded into the FDF.

Now you need to get the file out of the of the FDF. That's a different process. To do this you need the FDF toolkit. It's free. But unfortunately requires some programming skills. You can down load it from here:

http://www.adobe.com/devnet/acrobat/fdftoolkit.php

It constains a function specifically for extracted submitted files out of an FDF, "FDFExtractAttachment()".

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

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