Hi
Just finished helping a customer who wanted to add attachments to PDF using javascript. There are 2 ways to add attachments to a PDF form
1- using the attachments tab
2- Using javascript- with the help of a button the user selects the file to add to the pdf
I have included the PDF which allows the user to add attachment , view the attachment and deleted the selected attachment from the form.
Please click here to access the formPDF Form
PS- THIS WILL ONLY WORK WHEN YOU OPEN THE FORM WITH ACROBAT.IF YOU WANT IT TO WORK IN READER YOU WILL NEED TO APPLY USAGE RIGHTS USING THE READER EXTENSIONS ON THE SERVER
Adding Attachments to PDF Form
April 6, 2009 · 53 Comments
Categories: Form Attachments
Tagged: adding attachments, File Attachments
53 responses so far ↓
Aparna // April 7, 2009 at 3:13 pm |
What when you distribute the form or put in on web page? It doesn’t work there.
Girish Bedekar // April 7, 2009 at 11:36 pm |
Hi Aparna
The end user will need to have acrobat or you will have to Apply Usage rights using READER EXTENSION on the server
Also when you say it does not work – do you get any errors?
thanks
girish
Nicholas Wright // April 8, 2009 at 1:38 pm |
Hi, i’m trying to make an interactive pdf in acrobat pro 9. Firstly i want people using reader to be able to attach files. I like you pdf with attach boxes. Can you tell me the java script for programing the buttons etc. Will i then be able to activate this to work in reader or do i need to activate it in live cycle (probably trial version as i can’t afford it). Many thanks for your time and help,
Nicholas
Girish Bedekar // April 8, 2009 at 4:34 pm |
Hi Nicholas
The javascript for the buttons can be seen when you open the form in livecycle designer.(Comes free with acrobat). To make the form fully functional for your end users who have reader, you will have to apply usage rights using livecycle server software.you can also try acrobat.com to see if there is any way to apply usage rights.
Also if possible can you please explain me your usecase/problem you are trying to solve
thanks
girish
Nicholas Wright // April 8, 2009 at 6:02 pm |
Hi Girish, thanks for your very swift reply. I’m trying to create a pdf form for my work. We’re a small land surveying company and we want to create a relatively simple form for people to fill in with data for us to get back to them with a quote. It helps us if they include attachments of various information such as Google areal photos of the area, and land registry plans (indicating the boundaries of the land owned). Originally I was going to create a web page but the information is neater for us when enclosed in a pdf document. I’m using adobe cs design premium which comes with acrobat pro 9 (not extended) and i’m working on a mac. As far as i am aware there’s no live cycle designer bundled with it (possibly because it’s on a mac) but to be honest i’m completely new to acrobat and live designer so it could be staring me in the face!
Girish Bedekar // April 8, 2009 at 8:03 pm |
you are right livecycle designer is only available on windows
Nicholas Wright // April 8, 2009 at 9:19 pm |
Hum, thought so, can’t understand why it doesn’t work on a mac when everything else does. Id di download a trial onto my pc so maybe i can use that to try and activate whatever it is i need to do to see if it works. Is the live cycle server software part of live cycle designer or is it something else. It’s all so confusing that adobe seem to have about 4 different programs and techniques to create much the same thing (or so it seems to the novice). Acrobat pro is seeming like a less and less powerful program by the day! Many thanks, Nicholas
Girish Bedekar // April 9, 2009 at 3:35 am |
Hi Nicholas
Read your comment, I understand your point. Some clarfications
Livecycle designer is an WYSIWG tool for designing interactive PDF forms.
Adobe LiveCycle® ES (Enterprise Suite) software is an integrated server solution that blends data capture, information assurance, document output, process management, and content services to help you create and deliver rich and engaging applications that reduce paperwork, accelerate decision-making, and help ensure regulatory compliance
More info can be found on this site
http://www.adobe.com/products/livecycle/
Reader Extensions is an integral part of LiveCycle ES.
Let me know if I can be of any further help
thanks
girish
Nicholas Wright // April 9, 2009 at 8:29 am |
HI Girish, thank you, you have been more than helpful. Just one more question (probably leading to another fifty!). I’ve opened adobe livecycle designer se (trial version on pc) to see if i can create the form. When i open your pdf’s with the attachment boxes it open and says if i save it all info will be lost but when i click on the various buttons to view the script there is nothing that i can see. The open file and delete file buttons seem to work (they open a box saying basicaly cannot do the action as there is no atachment already in your viewing box). The attach file button seems to do nothing though and when i look at the programming for the buttons it looks like thay are set to form calc and i just cannot for the life of me see where the script to program the buttons is. Please could you help me with a ‘for dummies’ step by step – however don’t worry if you’re too busy, i’m sure it’s a big ask. Many thanks again, Nicholas
Girish Bedekar // April 9, 2009 at 1:52 pm |
Hi Nicholas
That is strange, can you try to view the script editor from the window menu button
let me know
thanks
girish
Aparna // April 16, 2009 at 6:36 pm |
Hi Girish,
I am back with same prob. still on.
Actually as test before putting it on web, I distributed the form then opened it in Acrobat 9, filled it, and wanted to attached CV and photo, but the buttons doesn’t open any browser to browse from. It doesn’t give any errors. You are talking about server meaning that I should buy externally or it’s inbuilt in LiveCycle designer? Again, while playing arround to make those buttons work I also went in Advance and try to extend features in reader, it showed me error that they already been assigned.
So again back to where I was. Frankly, I not a programmer or much familiar with scripts so don’t know if I have make any changes in script before inserting the object in my form. Any help will be great, no hurry whenever you have time.
Have a great day. Thanks so much for reply.
Aparna
Girish Bedekar // April 19, 2009 at 11:23 pm |
Hi Aparna
Can you send me your form to mergeandfuse@gmail.com
will fix it for you
thanks
girish
tomson // May 26, 2009 at 6:34 pm |
Hi, very useful example but I wondering is there a possibility to add the content of attachment files to form’s xml ?
Girish Bedekar // May 26, 2009 at 9:32 pm |
Hi tomson
So you want the attachments contents somehow included in the form data when you export the form data as xml?
I do not think that is possible
thanks
girish
Taibah // June 25, 2009 at 6:00 am |
Hi
I have tried to use the attachemnt with my form but after sending the form over the email
attachement is lost ??
how can I do it?
Girish Bedekar // June 29, 2009 at 9:23 pm |
Hi Talibah
Are you sending the pdf or just the xml data in your email. If sending xml data there will not be an attachments,make sure the submit button’s format is set to pdf
Nick Dring // June 25, 2009 at 7:03 am |
Hi Girish, I’m in the same position as Aparna. I have a multi page pdf that was created in indesign cs4 to which I need to add the ability to insert a file. I opened your pdf and then my pdf in livecycle and tried to copy and paste the buttons, I get the same error as Aparna. When I import my pdf I suppose I need to select interactive form for the copy and paste to work?
Girish Bedekar // June 29, 2009 at 4:47 pm |
you need to create a xfa based pdf to use my script in the pdf
let me know
thanks
girish
Nick Dring // June 29, 2009 at 6:42 pm |
Hi Girish, thanks for the reply.
I don’t think InDesign CS4 can do a xfa pdf so would it mean remaking the pdf in lifecycle or is there another method.
Girish Bedekar // June 29, 2009 at 9:21 pm |
looks like you need to re-make the pdf using livecycle designer
thanks
girish
Mark // July 9, 2009 at 1:03 am |
Hi, this is exactly what I’ve been looking for. I too am unable to view the script in LiveCycle designer. Using Acrobat 8 Pro. Have tried everything but can’t view or edit any of the script in LiveCycle designer. Tried resaving the pdf, nothing works. Any suggestions? I can’t recreate the buttons in another document because I can’t view the script. Thanks!
Girish Bedekar // July 10, 2009 at 2:52 am |
Hi Mark
when you open the form in livecycle designer you should be able to view the script from the view menu and the choose the script editor option. I am on my vaction in India , so I am not sure about the exact menu option, but the script editor option is available in the top level menus in livecycle designer
thanks
girish
luca // July 22, 2009 at 9:42 am |
U are very good at this but i am not, after many tryouts i cannot make your scripts working in my form, i think it is because of different sort of form properties but i cannot understand how to change them to make this possibly work.
You say iti ahs to be a XFA type document but in livecycle i don’t see this particular voice, can you help me?
luca // July 22, 2009 at 10:36 am |
when u say “YOU WILL NEED TO APPLY USAGE RIGHTS USING THE READER EXTENSIONS ON THE SERVER” to which server u refer? and how? with acrobat or with livecycle?
Girish Bedekar // August 13, 2009 at 8:05 pm |
Hi luca
I meant the reader extensions server product which can do that for you
thanks
girish
luca // July 22, 2009 at 10:49 am |
I see an error when i open your file in my server, it says: “cannot save a copy compiled of the form on the computer, if u want a copy compile it and print it” so what it is needed in order to make this to happen? i am sorry for my ignorance but i need this to work and u seem to be a very good person to ask to, if u cannot no problem, until u answer i will continue to googling for it.
Girish Bedekar // August 13, 2009 at 8:05 pm |
Hi luca
is your problem solved?if not let me know
thanks
girish
luca // August 13, 2009 at 9:30 pm |
Hi Girish, my problem is not solved, i tried everything and i discovered some interesting good things in livecycle and made some form for other purposes but the “quest for attachment to PDF form” is very not solved.
I want only be able to do a file like yours that works with adobe reader giving possibility to upload attachments to a form and send it by email.
Do u have some guide to do it?
I tried with your file modifying it and trying to understand the code but nothing, is it too much difficult for me?
I really hope u can help me.
luca // August 13, 2009 at 9:55 pm |
I cannot understand why i cannot make it working even in preview like your file does, i copy it in my file but only one part is copied, the form, the rest (referenced objects+counter+scriptobject) i am trying to learn about them but the help guide of livecycle is not greatly userfriendly, i made the scriptobject and copied the code inside so now i am trying to understand the other 2.
Every advise about them is very appreciated.
Girish Bedekar // August 14, 2009 at 5:26 pm |
Hi luca
what version of acrobat do you have?
thanks
girish
luca // August 14, 2009 at 7:11 pm |
the version is 9 pro.
Mark Walker // August 15, 2009 at 2:38 pm |
I too think this is a great button and thank the author for providing it, as I had been looking for file attach in pdf. But after hours of trying to make it work in my own form I finally just redid my form in classic .asp and used cdo.sys for the file attachment. Works like a charm.
luca // August 22, 2009 at 5:35 am |
Thank you very much for helping me to reach the truth about this fantastic application, the only thing that was blocking me to use your file was the variable to be added in the form properties.
I owe u one and if i can i i would like to owe u more about another, for you will be very simple, function:
auto sending form to email of administrator and to user after filling and submitting.
Thanks again.
Samantha // September 24, 2009 at 11:27 pm |
Hi there!
I’m having the same problem as Aparna. I added the buttons to my form, but when I click the button nothing happens. I assume you solved the problem via private e-mail conversation. Could you help me out too?
Thanks a lot !
(running LiveCycle Designer ES v
Girish Bedekar // September 25, 2009 at 2:05 am |
When adding attachments to form you will need to use Acrobat , or you will need to Reader Extend the form. What are you using(Acrobat or Reader) to add attachments to the form. Also if you could send me the form to mergeandfuse@gmail.com
thanks
girish
Hermann // September 28, 2009 at 10:04 am |
Hi Girish
I tried this great script. Works fin alone – but included into an existing file not. In my file variables are allready defined. Could it be that your Variables interfere with the existing ones?
Regards
Hermann
(using Adobe 8 Pro)
Hermann // September 28, 2009 at 1:03 pm |
Hi Girish
Working with Adobe 8 I’ve just discovered that the list of attachments is empty when reopening the file after saving with attachments. I’ve no clue why.
Regards
Hermann
(using Adobe 8 Pro)
Girish Bedekar // October 1, 2009 at 5:07 pm |
Hi Herman
Is your problem solved
thanks
girish
Hermann // October 2, 2009 at 5:58 am
Hi Girish
Unfortunately I didn’t find a solution by myself. Could it be that my versions (Adobe Acrobat 8 Pro and 7 Standard) make any trouble?
Regards
Hermann
Hermann // October 2, 2009 at 2:30 pm
Hi Girish
Just to clarify: I doesn’t work with Adobe Acrobat 7 Standard. Attachments are there but will not show up in the List of Attachments. You may have an idea how to correct this. I didn’t succeed.
Unfortunately some of the users of my form still work with this version of Adobe Acrobat.
Regards
Hermann
Samantha // October 1, 2009 at 6:25 pm |
Hi Girish,
I sent you my form but never heard back from you. Unfortunately it’s still not working.
Thanks.
Girish Bedekar // October 3, 2009 at 4:54 am |
Hi
I just sent you the form, sorry for the delay
All you need to do is to add a variable called “counter” and set its value to 0. You can do this by opening the form in livecycle designer, and from the File | Form Properties
select the variable tab and create a variable called counter and set its value to 0. Tip when using acrobat you can open the debugger window by hitting ctrl-j
thanks
girish
tomson // October 1, 2009 at 7:36 pm |
Samantha are you opening your form in Reader or Acrobat ?
Tarek Faham // October 29, 2009 at 12:19 pm |
Hi,
Very useful script. Thanks a lot.
I need something simpler, and appreciate your help.
I want to write JavaScript for the “Click” event of a Button, to open the Attachments Tab only.
Appreciate your help.
Tarek.
Loralon // November 23, 2009 at 6:24 pm |
Hi Girish,
I am currently looking for help with a form that I am developing with LiveCycle Designer 8.2.
The form has an attachment (word document), which is opened and edited by the user, saved and closed. The attachment is needed because it gives advanced editing capabilities.
1) My request/challenge is to be able to print the form together with the attachment with only one print button so the printed copy includes the attachment content as well.
2) Or be able to transform the attachment into PDF and then merge it with the form so that we only have one PDF at then end.
I want to achieve the above using JavaScript as we currently don’t have LiveCycle ES deployed.
Thank you in advance for your assistance in this regard.
Girish Bedekar // November 24, 2009 at 1:20 am |
Hi
I am sorry you cannot do that without opening the attachments and printing it one by one
Livecycle ES can do all these very easily
thanks
girish
Loralon // November 24, 2009 at 3:31 pm
Thanks very much for your quick reply,
Will it be possible to display the content of the attachment inside the form? The aim is to be able to have a kind of preview of the attached document inside the PDF form.
Thanks
Marnsville // November 24, 2009 at 6:33 pm |
Hello, I am having a bit a difficulty with viewing my attachments. It works great when I am in the form, but after I submit the form via email, the attachments are missing. Any ideas? Thanks!!!
Girish Bedekar // November 25, 2009 at 4:38 am |
Hi Marnsville
Can you send me your form? send it to mergeandfuse@gmail.com
thanks
girish
Girish Bedekar // October 3, 2009 at 4:35 am |
Hi Hermann
So you have a pdf which has attachments, when this PDF is opened with Acrobat 7, the attachments do not show up? Is this correct
I will be out of office till Wednesday, returning on Thursday. I do not have Acrobat 7 handy, but will get to it once I return on Thursday
BTW are you in the US?
thanks
girish
Hermann // October 6, 2009 at 6:51 am |
Hi Girish
You’ve got it right.
I will be in this week and then be gone for two – desperately need holidays. And no, I’m not in the US -> European Mountains. What about an Indic name and India? ;¬)
Regards
Hermann
Hermann // October 28, 2009 at 6:29 am |
Hi Girish
Back from holidays and full of energy I’m eager to get my form working. Did you may had a spare minute to look into the problem?
Regards
Hermann
Girish Bedekar // November 25, 2009 at 4:40 am |
Hi Loralon
I do not think that is possible at least for non PDF attachments. PDF attachments ma be possible, but I am not sure. Sorry could not be of any help here.
girish