Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Sending a PDF form without a desktop email application

Avatar

Level 4

I developed a PDF form using Livecycle and now discoved that the computers that users have do not have an email client installed. instead, they use OWA. So my Save and Send Email button will save the PDF but not email it. Is there a way to send the PDF (I've read something about http or server-side scripts) that will be automatic so that the user doesn't manually have to attach the saved file to an OWA email and type in an email address? We've used pdformail.asp in the past, but, for some reason, it's not working for me now.I get a message saying that the page can't be displayed. The code for this action page is copied below.

<%

Dim strMasterPath
Dim PDForm

' Acquire the server default path
strMasterPath = Server.MapPath(Request.ServerVariables("PATH_INFO"))
strMasterPath = Left(strMasterPath,InstrRev(strMasterPath,"\"))

' Initiate the formium object and call the Render function
Set PDForm = Server.CreateObject("formium.core")

Call PDForm.render_PDForMail(0)

' Close out the object       
Set renderPDF = Nothing
%>

16 Replies

Avatar

Level 4

Acrobat submits forms to a server as a standard HTTPRequest.  The data is stored in the body of the request in the format specified by the submit action on the PDF.  If you can write any kind of server side script, then you can probably write a script to package up the contents of the HTTPRequest into an email attachment and send it off.  That's all that the pdfformail.asp does.  But there are many, many ways to do the same thing.  For example here's a PHP script that emails HTML form data:

http://formtoemail.com/

I know, you're saying "But I have a PDF form".  Well, as it happens, one of the PDF submission formats is HTML. So to a server script there's no difference between data submitted from an HTTP form and a PDF form.  There's also a thread at www.acrobatusers.com where a whole ASP.NET script is posted for doing this exact same thing for any kind of data submitted from a PDF, unfortunately the search on the site is broken so I don't know how you'd get to it:(

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Level 4

Thom,Thank you for your response. Without an email client, like Outlook, can a PDF form be emailed to a recipient and arrive as a PDF form? When you write, " But there are many, many ways to do the same thing," that surprises me. I've done a fair amount of Googling, and I don't see many alternatives. Since we already have pdformail.asp, I'm trying to go with that. But, as I described, it doesn't work for my new forms. It works for older forms that the company has been using for a long time, but even the sample forms that come with the PDForMail application don't work. I've checked to make sure that the blank forms are in the Masters directory, and they are. Are you familiar with PDForMail? I'm reading through the manual now, but I don't see why my forms and the sample forms aren't working right now, yet old company forms do work.Thank you for any advice or other suggestions you might have.Sean

Avatar

Level 4

I've found out that we can't use PDForMail any longer, for various reasons. What options do I have? The requirements are that the recipient has a PDF form for printing out and for managing form data with Acrobat Pro (merging files into an Excel spreadsheet).

Avatar

Level 4

I read somewhere online about PDF form submission via HTTP and SOAP and a WSDL. Can anyone suggest a link or links to sites that can help?

Avatar

Level 4

I've gone on and have come across suggestions about using a CGI script on a Web server. A form submit button could point to a script on a Web server, and the CGI script could parse the form (FDF to PDF, I think) and then email the PDF. Is there a site where I could get a CGI script to get started?

.

Avatar

Level 4

Actually, I believe that this was the point of my post, that you could write a server side script to mail off the submitted data.  And the server side script doesn't have to do any parsing, it can be very simple.  All it needs to do is to write all the bytes in the body of the HTTPRequest into a file attachment for an email.  The language used to write the server side is irrelevant.  You should go with whatever works best for you.   What's available on your server, and what programming skills do you or your co-workers have?  Usually your hosting service can provide programming help for this kind of thing.  There are also services that can set you up with a complete form solution, www.formrouter.com.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Level 4

Yes, let's keep it simple. Can you point me in the direction of a script that will take a PDF that my user fills out and sends to the Web server? The result is that the same PDF form, and the data entered into it, is sent to a To: recipient and to a CC recipient, both of which are fields in the PDF form. Thank you for your suggestions.

Avatar

Level 4

Actually I've already done that in my previous posts.  I know that there are some scripts floating around out there for doing this sort of thing, but they probably aren't exactly what you want and are mostly for developers who can modify them for their own use.  I also pointed you to a form data service that can set this up for you, www.formrouter.com.  I also know that someone actually created a product for doing this j(just like pdfformmail.asp), but I don't have that information immediately available and you can google just as well as I can.   

I know for a fact that this is a fairly simple script to write because I've done similar scripts, but it's not trivial and what you really need to do if you can't write the script yourself is to either buy the service I mentioned or pay a developer to do it for you.  

Avatar

Level 4

Good enough! Thank you for all your help, which has clarified the situation. I'm off in the hunt for scripts!

Avatar

Level 4

Here's a tool that generates ASP.NET code for doing the submit redirect to email:

http://www.nk-inc.com/software/pdfemail.net/

It's listed as a developer tool so I'm not sure how much programing you'll have to do to make it work.

But these guys also do development so I'm sure they could easily build you a solution.

Avatar

Level 4

I'm looking for JSP or PHP scripts, and I've found one, but the way scripts work raises a question. This PHP script I'm looking at (http://dbmasters.net/node/18) has hard-coded email addresses entered into the script. What I need is a script that will grab the email address from the PDF form itself and this needs to be a conditional, like this,

if the user makes one type of selection in the form, then send to emailTo.rawValue address

else send to emailTo2.rawValue address.

Are there scripts that can do this? Ideally, I'd also like to grab some other fields from the PDF form and insert those in the email. The name fields and the type of request field and the region number and the store number.

With Livecyle, I can do all this with javascript on the submit button, but this only works with an email desktop application, like Outlook.

Avatar

Level 4

Here's the javascript on the Submit button, and I'd like a script that would grab user-entered values in the PDF form in the same way. Is this possible?

form1.page3.emailSubform.emailToBtn::preSubmit:form - (JavaScript, client)

app.execMenuItem("SaveAs");

//either way below works
//event.target.submitForm({cURL:"mailto:"+ strToAddress + "?cc=" + strCCAddress + "&subject=" + strSubject + "&body=" + strMessage,cSubmitAs:"PDF",cCharset:"utf-8"});
if (txtCCAddress.rawValue == null) {
var strToAddress, strSubject, strMessage, strSuffix, strMgrFirstName, strMgrLastName, strStoreNum, strRegionNum

strToAddress = txtToAddress.rawValue;
strSuffix = form1.Page1.DropDownList1.rawValue;
strMgrFirstName = form1.page3.MgrFirstName.rawValue;
strMgrLastName = form1.page3.MgrLastName.rawValue;
strStoreNum = form1.Page1.storeNumber.rawValue;
strRegionNum = form1.page3.distRegion.rawValue;

this.resolveNode("#event").submit.target = "mailto:" + strToAddress + "?subject= " + "LOA request for " + strSuffix + " DSM " + strMgrFirstName + " " + strMgrLastName + " Store# " + strStoreNum + " Region# " + strRegionNum;
    }
    else
    {
    var strToAddress, strCCAddress, strSubject, strMessage, strSuffix, strMgrFirstName, strMgrLastName, strStoreNum, strRegionNum
   
strToAddress = txtToAddress.rawValue;
strCCAddress = txtCCAddress.rawValue;
strSuffix = form1.Page1.DropDownList1.rawValue;
strMgrFirstName = form1.page3.MgrFirstName.rawValue;
strMgrLastName = form1.page3.MgrLastName.rawValue;
strStoreNum = form1.Page1.storeNumber.rawValue;
strRegionNum = form1.page3.distRegion.rawValue;

    this.resolveNode("#event").submit.target = "mailto:"+ strToAddress + "?cc=" + strCCAddress + "&subject=" + "LOA request for "  + strSuffix + " DSM " + strMgrFirstName + " " + strMgrLastName + " Store# " + strStoreNum + " Region# " + strRegionNum;
    }

Avatar

Level 4

There is a very simple way to pass info to a server script.  Add it to a query string in the URL.  Use JavaScript on the submit button in the PDF to grab the email from a form field and then paste it onto the end of the URL.  The submitted data is in the Body of the HTTPRequest, a query string doesn't affect this and it gives the PHP script easy access to the data it needs.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Avatar

Level 4

Great idea! That would do it! Thank you for this solution!

Avatar

Level 4

I need some help in passing the form values via query string parameter. The javascript that I already have on the form button looks like this

    var strToAddress, strCCAddress, strSubject, strMessage, strSuffix, strMgrFirstName, strMgrLastName, strStoreNum, strRegionNum
   
strToAddress = txtToAddress.rawValue;
strCCAddress = txtCCAddress.rawValue;
strSuffix = form1.Page1.DropDownList1.rawValue;
strMgrFirstName = form1.page3.MgrFirstName.rawValue;
strMgrLastName = form1.page3.MgrLastName.rawValue;
strStoreNum = form1.Page1.storeNumber.rawValue;
strRegionNum = form1.page3.distRegion.rawValue;

    this.resolveNode("#event").submit.target = "mailto:"+ strToAddress + "?cc=" + strCCAddress + "&subject=" + "LOA request for "  + strSuffix + " DSM " + strMgrFirstName + " " + strMgrLastName + " Store# " + strStoreNum + " Region# " + strRegionNum;
    }

So I added a parameter to the button URL,

http://www.ourserver/formmailer.php?CC=strCCAddress

and in the PHP form handler, I have this

<?php
//Check whether the form has been submitted
echo "Email To Address: {$_GET['CC']}<br />";

?>

The result is this

Email To Address: strCCAddress

Can you point out what's going wrong here? Thank you.

Avatar

Level 4

You can't put a variable directly into an URL.  The URL has to be rebuilt dynamically in a script.  In a way very similar to how you are modifying the email URL.  Here are some articles on the topic.

http://acrobatusers.com/search/google/submit?query=submit&cx=010702214422959725198:mrw4k197ftq&cof=F...

Filter the results for the tutorials.  In the articles there is also some JavaScript shown that you can use to do the same thing.  For submitting dynamic URL info the JS is probably a better way to go.

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)