Expand my Community achievements bar.

Sending PDF Form Data without Email Client

Avatar

Former Community Member
Hello,



I have made PDF Fillable Form where user can fill out the form and submit the form. I know we can create submit button and submit as PDF will attach the existing PDF Form in the default email client and when user click on send button form will email to specific defined email address.



My point is I would like to bypass the email client and assign SMTP server address so it automatically sent to defined default email recipient. Can anyone tell me how I can go this? I have number of forms that I would like to put on the web and make user comfortable to fill out and just one click sends that form to us.



Thanks,

Yash
20 Replies

Avatar

Former Community Member
I m facing the same problem, 've you got any solution ?

Thanks

Avatar

Former Community Member
You cannot bypass the mail client ...but you could http post the PDF to a web server program and have that smtp the file where it needs to go.

Avatar

Former Community Member
HEllo Jalid,



I am trying to figure out via Jmail SMTP component. I will update once I figure out the solution.

Avatar

Former Community Member
Hi Paul,

Thanks for replaying

I m a begginner in livecycle ES

How to 'http-post' a PDF file to a web server ??

Avatar

Former Community Member
I am also a begginner in the livecycle ES but I am googling things and figure out the solution that's the best way to find out the ways !

Avatar

Former Community Member
Thanks Ypanchal for googling !

What is the difference between LiveCycle ES 8.2.1 and LiveCycle Workbench ES ? is it an upgrade of livecycle ?

Avatar

Former Community Member
Jalid,



You need Adobe LiveCycle Designer that designs form.

Avatar

Former Community Member
Here some example code of sending PDF via HTTP Submit
<br />
<br />// Begin the upload process.
<br />xfa.host.messageBox("This may take over 60 seconds.")
<br />event.target.submitForm({cURL:"http://XX.XX.XX.XX/XMLupload10.php?random="+mcode,cSubmitAs:"XML",cCharset:"utf-8"});
<br />event.target.submitForm({cURL:"http://XX.XX.XX.XX/PDFupload10.php?random="+mcode,cSubmitAs:"PDF",cCharset:"utf-8"});
<br />
<br />Here is an example PHP file that receives it on the other end:
<br />
<br /><?<br /?>
ini_set('max_execution_time', 200);
<br /> require_once("configuration.php");
<br /> $conf=new JConfig();
<br /> $con=mysql_connect($conf-&gt;host,$conf-&gt;user,$conf-&gt;password);
<br /> mysql_select_db('XXXX_XXXX',$con);
<br />
<br /> define('ADMIN_ROOT_DIR',dirname(__FILE__));
<br /> //$xml_uploaddir = ADMIN_ROOT_DIR."/XXXXXX/xml/";
<br /> //$pdf_uploaddir = ADMIN_ROOT_DIR."/XXXXXX/pdf/";
<br /> $xml_uploaddir = substr(ADMIN_ROOT_DIR,0,strrpos(ADMIN_ROOT_DIR,"/"))."/xml/";
<br /> $pdf_uploaddir = substr(ADMIN_ROOT_DIR,0,strrpos(ADMIN_ROOT_DIR,"/"))."/pdf/";
<br />
<br /> function random($length)
<br /> {
<br /> $hash =date('YmdHis',time()+8*3600)."_";
<br /> $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
<br /> $max = strlen($chars) - 1;
<br /> mt_srand((double)microtime() * 1000000);
<br /> for($i = 0; $i &lt; $length; $i++)
<br /> {
<br /> $hash .= $chars[mt_rand(0, $max)];
<br /> }
<br /> return $hash;
<br /> }
<br />
<br /> $file_path = $pdf_uploaddir.random(10).".pdf";
<br /> $temp = split("/",$file_path);
<br /> $pdf_path = $temp[count($temp)-2]."/".$temp[count($temp)-1];
<br />
<br /> $body = file_get_contents("php://input");
<br /> $fp=fopen($file_path,"w");
<br /> fwrite($fp,$body);
<br /> fclose($fp);
<br />
<br /> $random_key = trim($_GET['random']);
<br /> //print_r("Random Number: ".$random_key."
<br />");
<br /> /*
<br /> $xml=simplexml_load_file($file_path);
<br /> $nodes=$xml-&gt;xpath("/form1/P1");
<br /> $xml_groupname=$nodes[0]-&gt;group_name[0];
<br /> $xml_checkin_date=$xml-&gt;DateofArrival;
<br /> $xml_contact_person=$nodes[0]-&gt;contact_name[0];
<br /> $xml_contact_email=$nodes[0]-&gt;contact_email[0];
<br />
<br /> $sql = "insert into XXX_xml_files (status,file_path,pdf_path,group_name,checkin_date,contact_person,userid,add_time,email) values (0,'$xml_path','','$xml_groupname','$xml_checkin_date','$xml_contact_person',0,now(),'$xml_contact_email')";
<br /> mysql_query($sql);
<br /> mysql_close($con);
<br /> */
<br /> $sql = "select * from XXX_xml_files where r_key='".$random_key."'";
<br /> $result = mysql_query($sql);
<br /> $count = mysql_num_rows($result);
<br /> if($count &gt; 0) {
<br /> $row = mysql_fetch_array($result);
<br /> $sql = "update jos_xml_files set pdf_path='".$pdf_path."' where xid=".$row['xid'];
<br /> mysql_query($sql);
<br /> }
<br /> else {
<br /> $sql = "insert into jos_xml_files (file_path,pdf_path,r_key) values ('','$pdf_path','$random_key')";
<br /> mysql_query($sql);
<br /> }
<br /> mysql_close($con);
<br /> $message = "
<ul class="noindent">
<li>PDF file is uploaded successfully.</li>
<li style="list-style: none">";
<br />?&gt;
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></li>
</ul>
<div id="showmsgmain">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table width="57%" align="center" style="border:1px solid #e5e5e5">
<tr>
<td height="25" bgcolor="#E5E5E5">&#160;Information uploaded!</td>
</tr>
<tr>
<td height="122">
<br />
<div style="margin-left: 2em; color:#0066CC;">
<br /> <?php echo $message;?>
<br />
<br /></div>
<br /></td>
</tr>
</table>
<br /></div>
<br />
<br />

Avatar

Former Community Member
mcode = Some random number we use in the sending of both the PDF & XML so that our server can know that they are associated.

Avatar

Former Community Member
Hi Ypanchal,



I 've LiveCycle Designer 8.2.1 SE but LiveCycle Workbench ES is another licence product witch permit usage of SMTP operations



Thanks

Avatar

Level 8
Level 8
So I am wondering , if you use HTTP post, can you in any way make sure that the entire PDF it submitted? And if this is not the case, how can you tell the user that something has gone wrong?



Thanks in advance



Sincerely

Kim

Avatar

Former Community Member
Hello Kim,



I am configured the asp page via jmail SMTP component installed on the server. I just created a simple submit button in the PDF file and link that button to the server address http://xxx.com/xx.asp and it's working fine and sending the whole filled out pdf form to the recipient via jmail smtp mail component in the attachment. But I don't like to time spent to sending that pdf of 91 seconds, so I am working on to cut down the time to the resonable amount.



Yash

Avatar

Former Community Member
Yes ...in the submit button options you can choose what you want to submit. PDF is an option.



To get a response back from the server - if you are in a browser then when you return the message about valid submission (usually HTML) the browser will take care of it. If it is stand alone Acrobat/Reader then it does not know what to do with the HTML. You will have to return a PDF with an appropriate message in it.

Avatar

Former Community Member
Paul,



I want to be able to submit a pdf form to a web server (user has no email clinet) and then have web server email to another user using smtp. I saw your php "receive code" from 11/10/08. Can you post similar .net code?

Thanks.

Avatar

Former Community Member
I do not have PHP code but yes you can do the same thing. Acrobat/Reader simply does a post to a web server. You can write whatever you want to pick up the submission from the web server.

Avatar

Former Community Member
Paul,



Thanks for the update.



Do you know when I might find example on how to receive a http post from a pdf to a web server and then send out an email from web server with the pdf attached?



Thanks.

Avatar

Former Community Member
I am sure that if you do a google search you woudl find something ....this is not an uncommon thing to do.

Avatar

Former Community Member
Mostly just reading the pdf document (field by field) and updating a database. I want a user to submit a completed pdf form to a web server, have the web server redirect the posted pdf to the appropriate user using smtp.