Forum Moderators: coopster

Message Too Old, No Replies

PDF FDF string emailed as attachment

Capture PDF form FDF string

         

jwsheff

3:23 am on Apr 8, 2009 (gmt 0)

10+ Year Member



Hi All,

I am a real newbe with PHP so please excuse me for asking a question that may seem real easy. I have a PDF form online that our customers open in their browser, populate the rather large form then email it as an attachment to our company service manager using the customer’s client side default email program. The problem of course is we can not depend on the email configuration on our customer’s computer and as a consequence we do not always get the email.

What I would like to do is use the Adobe Submit Form command to POST the FDF data to a server side PHP program that will capture the FDF string and email (from the server) the string as an attachment to our service manager. The service manager can use the FDF file to populate a template of the PDF form.

I have been playing with file_get_contents('php://input') in my php script but the problem is I am missing all of the form field identifiers and data. My guess is the special characters used in the FDF string is ignored by the file_get_contents.

I want to thank you in advance for any help you can provide!

coopster

10:34 am on Apr 8, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, jwsheff.

That doesn't sound right to me for some reason. php://input will grab the raw input stream so perhaps it is something in your <form> element that is causing you issues. Also, rather than use the input stream and parse data yourself, are you aware of the $_POST superglobal array that prepares the data for you?

jwsheff

5:29 pm on Apr 8, 2009 (gmt 0)

10+ Year Member



Hi coopster thanks for your response.

I am using Adobe’s SubmitForm function with the FDF option that creates the FDF data string prior to sending it as part of the URL to my PHP program. I get all the data of the string but the field information. I didn’t think $_POST would work with FDF data because there is not the same tag values as associated with a HTML post string. Here is what the FDF string should look like for my small test PDF form with 3 fields:

%FDF-1.2
%âãÏÓ
1 0 obj
<</FDF<</F(form testing.pdf)/Fields[<</T(description)/V(928 204-1517)>><</T(email)/V(email@example.com)>><</T(name)/V(John)>>]/ID[<0C10400DCC483F778385452BA8A48CA3><A0ACCDDBC1C7A24FA0F8D05D975102D2>]/UF(form testing.pdf)>>/Type/Catalog>>
endobj
trailer
<</Root 1 0 R>>
%%EOF

And this is what I get from the PHP program input stream:

%FDF-1.2 %âãÏÓ 1 0 obj <<<><><><>]/ID[<0C10400DCC483F778385452BA8A48CA3>]>>/Type/Catalog/Version/1.3>> endobj trailer <> %%EOF

It seems like the > and < act as escape characters.

[edited by: eelixduppy at 10:56 pm (utc) on April 9, 2009]
[edit reason] removed specifics [/edit]

jadebox

5:58 pm on Apr 8, 2009 (gmt 0)

10+ Year Member



I think you're getting the right results, you are just displaying them incorrectly. If you try to view the results in your browser, you're going to see what you describe because the words inside "<>" characters will be interpreted as HTML tags. Try viewing the source of the page with your results. Or use htmlentities on the string when you echo it.

-- Roger

jwsheff

6:13 pm on Apr 8, 2009 (gmt 0)

10+ Year Member



Thank you Thank you Roger! As soon as you said that I knew you were right. I was so caught up in the PHP data that I didn't think of the display.

Thanks again!