Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving to Server and Email using a SMTP server

Status
Not open for further replies.

mcelligott

Programmer
Apr 17, 2002
135
US
We have a PDF form we are currently using. Once it is filled out, it is printed but not saved online. We would like to go green so I would like to add two pieces of functionality to it in one button. Unfortunately I do not have any experience doing this with Javascript. I would create the funcionality in Adobe Acrobat X Pro but the people filling out the form would do so using Adobe Reader.

The first piece of functionality would be to save the PDF with the form data to a location on our server. The name of the document would come from a couple of fields in the PDF (ex: John Smith DOR 7-8-14.pdf). The name and date would come from fields in the form but the "DOR" part would be the same every time. The form is being completed and saved to our in-house server. The saved form would still need to be editable by the indivdual reviewing it (see the second piece of functionality).

The second piece of functionality would be to send an email notification to an individual (same person every time) letting them know the PDF form has been completed. I only need to send the notification, not the PDF itself. In addition, I would like to include the name on the form as part of the text notifying the individual (ex: John Smith has a DOR to be reviewed). The name would come from a field in the form but "has a DOR to be reviewed" would be the same every time. The problem is that we use an internet based email client (Lotus Notes). I have the port # and designation of the SMTP server.

I hope I have explained it well enough and included sufficient detail in order to get the help I need.

Thank you in advance for any help anyone can offer. [bigsmile]
 
Is this a form to be used internally, only at your employer? There could be major security issues involved if you distribute a PDF form that includes SMTP authentication information. Others could take that information and use your mail server for spam.

Saving individual PDF files for each record is not much more efficient than printing out each form. You're saving a few leaves on a tree but you still have a disorganized mess. You may find joy in stepping it up to having all this form data collected in a database. There should be description of this in the LiveCycle Designer documentation and in articles like this:
 
mcelligott said:
...save the PDF with the form data to a location on our server...
If you make that location a fixed folder, another way to accomplish this might be a folder watcher that sends that notification once the pdf has been saved in that folder.
.Net framework, for example, has a FileSystemWatcher Class.
You could write a little .exe in VB.Net or C# that would observe that folder and on file creation in that folder sends out the notification.
That way the SMTP authentication details would not be required in any distributable file.

Cheers,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Hi spamjim,

Yes, the form is only being used within our department. I would love for them to go to a database set up but management is resistant at this point. At least by saving the PDFs to the server it will save at least one whole tree. It is amazing just how much paper we use just with this one form currently.

Thanks for the response.

Hi MakeItSo,

The location the PDF will be sent to is a fixed folder location. I have never heard of such a thing as a folder watcher and wouldn't even know how to write that kind of code. I have a little bit of VB knowledge but nothing at that level of knowledge. I would be interested to see a sample of that and how to install it, especially the part about sending the notification to the SMTP server in order to send the email.

Thank you for your response.

Now if I can just figure out how to automate the process of saving the PDF to the static folder location with the information as stated in the original post.
 
OK,

Part 1.) Custom save button:
You will need a Javascript action behind it. The Javascript will probably look somewhat like this (hope the JS scracks can help out here):
Code:
var savename=this.getField("firstname") + ' ' + this.getField("lastname") + 'DOR ' + this.getField("date");
this.saveAs(savename);

Part 2.) Watch4Folder seems to be a nice way to do it. It is freeware and can fire an executable on events:

Then you'd only need a batch file or whatever to send out the notification.

Cheers,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Hi again MakeItSo,

I created a button with the javascript you recommended but it did not work. I tried to save the PDF to the local computer first just to see if it would do it before I tried to tackle saving it to a network folder. I have been doing some research and found some reference to a "folder-level trusted function". Do I need to do this as well, whatever it is? Here is the code I used (I used the fields from the PDF I use):

Code:
 var savename='/c/temp/' + this.getField("Trainee") + ' DOR ' + this.getField("Month") + '-' + this.getField("Day") + '-' + this.getField("Year");
this.saveAs(savename);

I really appreciate your help so far. Any thoughts?

Bob
 
I would love for them to go to a database set up but management is resistant at this point.

Management is not opposed to change. They are opposed to cost. Doing this without a database is more costly, taking more time to implement, and requiring more time to process/analyze aggregate data.
 
It would appear that this.saveAs is disabled by security in Acrobat Reader. :-/

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top