How do you retrieve PDF when passed to PHP script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dzynit
Forum Newbie
Posts: 8
Joined: Tue Jul 03, 2007 8:15 am

How do you retrieve PDF when passed to PHP script

Post by dzynit »

I have a pdf created that submits as a pdf - basically passing the completed pdf form in full.

What I would like is to allow the pdf to submit to a php script then have the php script grab that pdf and either save to a directory or mail an attachment using mail(). At first I assumed I could get the pdf as if it were directly uploaded, but seems it doesn't work that way and I haven't been able to find the correct php calls to grab it.

Reason I need this is the adobe email submit button requires the users to have an email client set up on their computer. For this form, many users will not have that so I need to be able to actually send it through the server as you would normally with a regular php or html form. But the filled in pdf is the absolute requirement to be emailed. (This is a patient form being sent to a doctor for a new electronic signature and filing system, which requires all forms to be received in pdf format.)

(I've had no luck with the fpdf, fpdi, or others. Really have no interest in continue to attempt with those.)
And for further info: I have the reader extensions enabled, the form is usable for filling out on adobe reader on any pc with unlimited use. I used Adobe Live Cycle Designer to create the form.

Thanks for any help,
Heather
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Re: How do you retrieve PDF when passed to PHP script

Post by William »

dzynit wrote:I have a pdf created that submits as a pdf - basically passing the completed pdf form in full.

What I would like is to allow the pdf to submit to a php script then have the php script grab that pdf and either save to a directory or mail an attachment using mail(). At first I assumed I could get the pdf as if it were directly uploaded, but seems it doesn't work that way and I haven't been able to find the correct php calls to grab it.

Reason I need this is the adobe email submit button requires the users to have an email client set up on their computer. For this form, many users will not have that so I need to be able to actually send it through the server as you would normally with a regular php or html form. But the filled in pdf is the absolute requirement to be emailed. (This is a patient form being sent to a doctor for a new electronic signature and filing system, which requires all forms to be received in pdf format.)

(I've had no luck with the fpdf, fpdi, or others. Really have no interest in continue to attempt with those.)
And for further info: I have the reader extensions enabled, the form is usable for filling out on adobe reader on any pc with unlimited use. I used Adobe Live Cycle Designer to create the form.

Thanks for any help,
Heather
Unless Adobe Live Cycle Designer has an option to send the PDF with the form submission, it's not possible, at least not to my knowledge. What would stop you from taking the submitted data and generating a new PDF to send as an attachment server side? By doing this, you could also encrypt and lock the document from being tampered with.
ChadS
Forum Newbie
Posts: 4
Joined: Mon Jun 29, 2009 2:46 pm

Re: How do you retrieve PDF when passed to PHP script

Post by ChadS »

I am also having this problem. I created a PDF form in Acrobate Pro. I want the completed form sent to a webpage so that I can email it. Where I am stuck is I can't figure out what to use in order to grab the incomming pdf. Is it as simple as a _get or _post? Or is there some other command to specifically grab a pdf?
izzy4505
Forum Newbie
Posts: 16
Joined: Tue Aug 11, 2009 1:38 pm

Re: How do you retrieve PDF when passed to PHP script

Post by izzy4505 »

This is possible, but why would you want to do it? Having a form that you submit over the web done as a PDF defeats the purpose of a PDF file as well as your website, and provides a slow, buggy, problematic user experience. Not everyone has Acrobat Reader, and many fewer have an up-to-date version of Acrobat Reader that actually works and doesn't crash out their browser.

So in the rare instance this is still what you want to do, check here:
http://blogs.adobe.com/stevex/2006/05/http_submit.html

I've never done it, but if you can put stuff in your PDF file to submit it to a URL, then do this in PHP to see your data..

Code: Select all

print_r($_POST);
That will show you all the variables that Acrobat Reader is giving you.

Again, I beg you to not do it this route. Build a normal web form. Your users will thank you. Even if you also have this printable form, build a web form in addition.
Post Reply