Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pwhitehead

macrumors 6502
Original poster
Jul 19, 2011
342
100
new jersey
We're looking to put various fillable PDF forms on a website such as applications, opra request forms, ect.. Is there a way using wordpress that I can put the fillable PDF on a page, have the person fill it out and hit a send button, but instead of having it open up the default email application, it sends a duplicate of the form filled out through a background web mail server? Thanks!
 

superscape

macrumors 6502a
Feb 12, 2008
937
223
East Riding of Yorkshire, UK
We're looking to put various fillable PDF forms on a website such as applications, opra request forms, ect.. Is there a way using wordpress that I can put the fillable PDF on a page, have the person fill it out and hit a send button, but instead of having it open up the default email application, it sends a duplicate of the form filled out through a background web mail server? Thanks!

It might be easier to look at sending XFDF data back to the server rather than the PDF itself...

https://partners.adobe.com/public/developer/en/xml/XFDF_Spec_3.0.pdf

...then just have a simple script sat on your server that accepts the XFDF and does whatever you want with it.
 

pwhitehead

macrumors 6502
Original poster
Jul 19, 2011
342
100
new jersey
Thanks a lot for both of your inputs, anymore advice would be much appreciated.. Yes, we have a full licensed version of Creative Cloud.
 

superscape

macrumors 6502a
Feb 12, 2008
937
223
East Riding of Yorkshire, UK
Sure.

Assuming you have some kind of web server running PHP that can accept uploads then you need to make a php file something like this:

Code:
<?php
//n.b. this script is for demo purposes only is is in no way suitable for real-world use!

$XFDFData = file_get_contents('php://input');

//make a file name using a time stamp - not necessarily guaranteed to be unique...
$theFileName = date("Y-m-d H-i-s").".xfdf"; 

//write the received data to the file
$fd = fopen($theFileName, "w");
fwrite($fd, $XFDFData, strlen($XFDFData)); //write into a file
fclose($fd);

//output some kind of response
echo "<html><body>Got it!</body></html>";

?>

As per my commend in the above code, that's a long way from being production ready code! It's just to show the general idea. Let's say that you save it as uploads.php.

All you then need to do is create a submit button in your web form, and point it to your script. See my screen shot.

Submitted xfdf should now appear in the same folder as your upload.php script, assuming permissions etc allow.

That's the general idea, anyway.

Note that viewers would need to download the PDF and submit it. If you want them to fill it in whilst on your web page then I'd suggest an html form would be a much better option - there are plugins that'll do that for you. I use http://contactform7.com for the support form at http://www.ghostotter.com Works fine for me.
 

Attachments

  • screen.png
    screen.png
    221.3 KB · Views: 162
  • Like
Reactions: pwhitehead

pwhitehead

macrumors 6502
Original poster
Jul 19, 2011
342
100
new jersey
Sure.

Assuming you have some kind of web server running PHP that can accept uploads then you need to make a php file something like this:

Code:
<?php
//n.b. this script is for demo purposes only is is in no way suitable for real-world use!

$XFDFData = file_get_contents('php://input');

//make a file name using a time stamp - not necessarily guaranteed to be unique...
$theFileName = date("Y-m-d H-i-s").".xfdf";

//write the received data to the file
$fd = fopen($theFileName, "w");
fwrite($fd, $XFDFData, strlen($XFDFData)); //write into a file
fclose($fd);

//output some kind of response
echo "<html><body>Got it!</body></html>";

?>

As per my commend in the above code, that's a long way from being production ready code! It's just to show the general idea. Let's say that you save it as uploads.php.

All you then need to do is create a submit button in your web form, and point it to your script. See my screen shot.

Submitted xfdf should now appear in the same folder as your upload.php script, assuming permissions etc allow.

That's the general idea, anyway.

Note that viewers would need to download the PDF and submit it. If you want them to fill it in whilst on your web page then I'd suggest an html form would be a much better option - there are plugins that'll do that for you. I use http://contactform7.com for the support form at http://www.ghostotter.com Works fine for me.

So doing it with contactform7, the only downfall would be the information is sent over in an itemized list with just text aside from having an actual form right? The thing that I love about contactform7 is not only is it free, but it has a browse button so the person can upload files too. You're awesome, thanks so much for your help!
 

superscape

macrumors 6502a
Feb 12, 2008
937
223
East Riding of Yorkshire, UK
So doing it with contactform7, the only downfall would be the information is sent over in an itemized list with just text aside from having an actual form right?

Yup.

Depending on what you want to do with the contents of the form, maybe you might be able to have some kind of AppleScript to parse out the contents of the email and do stuff with it.

You're awesome, thanks so much for your help!

Aaaah, shucks... ;-)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.