tag:blogger.com,1999:blog-1985725707144494069.post2795330229509603660..comments2023-10-06T01:13:43.591-07:00Comments on Clayton Shepard: Forms: FDF, PDF, and PHPClayton Shepardhttp://www.blogger.com/profile/11139128931368750934noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-1985725707144494069.post-88884031256906217522011-11-22T11:11:29.180-08:002011-11-22T11:11:29.180-08:00This is the first time I've actually been able...This is the first time I've actually been able to have the fdf file automatically attached to an email.<br />Is there a way to remove the vcard function?<br />I'm also needing to send the data to a mysql database or access file for record keeping.<br />Any thoughts?<br />BrandonBrandon Kemhttps://www.blogger.com/profile/12951641297348124252noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-30491558091947655692011-07-07T17:01:31.819-07:002011-07-07T17:01:31.819-07:00@b!Vd
As soon as something creates output (e.g. p...@b!Vd<br /><br />As soon as something creates output (e.g. print/echo/error/warning) then php *has* to send the HTTP header back to the client. Thus if you try to call the header() function after output has been created it doesn't work, since the header has already been sent.<br /><br />In your case, for some reason fdf.php is creating output on line 2. This should not happen, so I would check fdf.php and make sure it hasn't been modified.<br /><br />I don't remember this setup that well, but I have a lot of example code commented out. You may want to test just the fdf/browser part. If you create your html/pdf form values correctly, then you should just need something like:<br /><br /><?php<br /> include("./fdf.php");<br /> foreach($_POST as $name => $val) {<br /> $data[$name] = $val;<br /> }<br />$fdf_data=createFDF('http://example.com/application.pdf',$data);<br /> Header("Content-type: application/vnd.fdf");<br /> echo $fdf_data;<br />?><br /><br /><br />which may help you debug (note that this was just off the top of my head, and may have issues...). The fdf.php output you were experiencing may be the cause of the problem, but you'll have to your own debugging.<br /><br />Good luck. <br /><br /><br />P.S. It appears I was missing a semi-colon on that echo $fdf_data. I will fix it.Clayton Shepardhttps://www.blogger.com/profile/11139128931368750934noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-75667017486055422952011-07-07T12:35:49.737-07:002011-07-07T12:35:49.737-07:00What I was trying to say earlier was that I was ab...What I was trying to say earlier was that I was able to open both the attachments in my email and they are perfectly populated.b!Vdhttps://www.blogger.com/profile/02355305424857816336noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-70364103733120543712011-07-07T12:32:15.647-07:002011-07-07T12:32:15.647-07:00Hi Clayton
Thanks for this wonderful tutorial.
I ...Hi Clayton<br />Thanks for this wonderful tutorial.<br /><br />I have a small problem which I am hoping you can help me with it.<br />I used your exact code and just changed the email address and link of the final destination pdf. As I had seen in this comments section earlier, I had got a warning saying that<br /><b><br /><br />Cannot modify header information - headers already sent by (output started at ./fdf.php:2)<br /><br /></b><br /><br />SO I moved this header tag to the top of the submit.php<br /><br /><b><br />Header("Content-type: application/vnd.fdf");<br /></b><br /><br />Now the pdf file opens in the browser but there is no data on it. Also I get an email with the two attachments and both those attachments are perfect( as in locally when I try doing it , the pdf is populated)<br /><br />Any ideas as to where I am going wrong?<br /><br />Thanks againb!Vdhttps://www.blogger.com/profile/02355305424857816336noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-23832755572743815572011-07-07T12:17:42.657-07:002011-07-07T12:17:42.657-07:00This comment has been removed by the author.b!Vdhttps://www.blogger.com/profile/02355305424857816336noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-20703118040597283002011-05-14T11:41:17.732-07:002011-05-14T11:41:17.732-07:00Clayton,
Much thanks, this tutorial really clarif...Clayton,<br /><br />Much thanks, this tutorial really clarified how to handle the process of creating FDFs with PHP.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-9786193692363660382011-03-08T21:43:06.624-08:002011-03-08T21:43:06.624-08:00Hello Clayton, thanks for the tutorial. how ever i...Hello Clayton, thanks for the tutorial. how ever iam stating in php and there thing that I dont understand yet, I need to build a small application for my current job and they are asking me for that and iam in a hurry,I dont want to get fire. could you please help me out to do this app? we can talk about it and price on skype: logigen2, or mtaisigue@gmail.com.<br /><br />Thank you <br />RegardsUnknownhttps://www.blogger.com/profile/09050160972896813933noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-77187647095495707332011-01-28T00:18:31.046-08:002011-01-28T00:18:31.046-08:00Thank you so much!! I've been fighting with KO...Thank you so much!! I've been fighting with KOIVI's tutorial for a few days now and after going through yours it just simply works!! You've made me and more importantly my client very happy!Unknownhttps://www.blogger.com/profile/09542861781428043738noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-57498800615440890662009-06-27T05:40:38.884-07:002009-06-27T05:40:38.884-07:00If you pastebin it I may try to take a look when I...If you <a href="http://pastebin.com/" rel="nofollow">pastebin</a> it I may try to take a look when I have some time.<br /><br />You really should try to figure it out on your own though; I know its painful, but thats how you learn ;p<br /><br />Well, sometimes the only thing you learn is trivial, like that you missed a ';' somewhere, but it sounds like you could probably learn a little bit more than that =)Clayton Shepardhttps://www.blogger.com/profile/11139128931368750934noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-56369903805750759932009-06-25T05:56:27.816-07:002009-06-25T05:56:27.816-07:00could I send you my submit.php and fdf.php file vi...could I send you my submit.php and fdf.php file via email? Ive been working on this for like flippin two days and im going to explode. I could really use a hand.<br /><br />Thanks regardless,ztekneqhttps://www.blogger.com/profile/01065314894286003868noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-24729927124205985092009-06-25T05:26:14.687-07:002009-06-25T05:26:14.687-07:00As I just mentioned, if you try to output anything...As I just mentioned, if you try to output anything before the Header() call then it won't work. (PHP has to send header information before it outputs anything, so if you don't specify a header before creating output then it will create one for you.)<br /><br />Stop outputting anything before that header call and make sure you have adobe acrobat installed correctly.Clayton Shepardhttps://www.blogger.com/profile/11139128931368750934noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-33514905105892253292009-06-25T05:20:55.846-07:002009-06-25T05:20:55.846-07:00i used the root, but I put in the entire pdf url t...i used the root, but I put in the entire pdf url this time (building on a server backend)ztekneqhttps://www.blogger.com/profile/01065314894286003868noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-11799483635242290232009-06-25T05:19:05.801-07:002009-06-25T05:19:05.801-07:00recopied and put a space before the header and thi...recopied and put a space before the header and this is what I got.<br /><br />Warning: Cannot modify header information - headers already sent by (output started at /home/planetx2/public_html/phpformtest/fdf.php:9) in /home/planetx2/public_html/phpformtest/submit.php on line 64<br />%FDF-1.2 %???? 1 0 obj << /FDF << /Fields [ <><><><><><><><><><><>] /F (http://69.175.12.154/~planetx2/phpformtest/test.pdf) /ID [ ] >> >> endobj trailer << /Root 1 0 R >> %%EOFztekneqhttps://www.blogger.com/profile/01065314894286003868noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-58709077050080435842009-06-25T05:12:51.045-07:002009-06-25T05:12:51.045-07:00You will notice the second to last line of code in...You will notice the second to last line of code in submit.php says:<br /><br />Header("Content-type: application/vnd.fdf");<br /><br />This line is what tells the browser what kind of information is being sent to it, and, thus, how to render it. If this line isn't there or malfunctioning (as it will do if you echo/print something before you get to this line), then the browser will display the fdf file rather than use adobe to open it.<br /><br />If Adobe Acrobat is not installed properly then the browser may not know what to do with a fdf file even if it gets this line, and may just display the fdf as text.<br /><br />After you have corrected both of these issues then you may also have a problem with adobe finding the original pdf file, since it appears that you have it referenced simply by "./test.pdf".<br /><br />Good luck.Clayton Shepardhttps://www.blogger.com/profile/11139128931368750934noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-31041141150764789002009-06-25T05:09:48.747-07:002009-06-25T05:09:48.747-07:00I guess I'd have to say that I copied your stu...I guess I'd have to say that I copied your stuff and used it, I obviously generated my own pdf and custom textfields of course....<br /><br />C<br /><br />So when you say set the header....I cant answer other then I used what you hadztekneqhttps://www.blogger.com/profile/01065314894286003868noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-23799189539828737782009-06-25T05:06:13.702-07:002009-06-25T05:06:13.702-07:00This comment has been removed by the author.ztekneqhttps://www.blogger.com/profile/01065314894286003868noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-13168908557028943972009-06-24T22:19:32.182-07:002009-06-24T22:19:32.182-07:00@cameron
It looks like it *could* be a valid (emp...@cameron<br /><br />It looks like it *could* be a valid (empty) fdf file... are you setting the header properly?Clayton Shepardhttps://www.blogger.com/profile/11139128931368750934noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-16326466943420198352009-06-24T18:26:26.317-07:002009-06-24T18:26:26.317-07:00so ive got everything loaded and adjusted properly...so ive got everything loaded and adjusted properly but i get <br /><br />%FDF-1.2 %???? 1 0 obj << /FDF << /Fields [ <><><><><><><><><><><>] /F (./test.pdf) /ID [ ] >> >> endobj trailer << /Root 1 0 R >> %%EOF<br /><br />any suggestions?ztekneqhttps://www.blogger.com/profile/01065314894286003868noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-72928594294650073202009-05-17T04:15:00.000-07:002009-05-17T04:15:00.000-07:00Thank you for this! Have been trying to implement ...Thank you for this! Have been trying to implement a similar system using Justin's FDF class, your post has been very informative and has helped me out a lot. Thanks.Unknownhttps://www.blogger.com/profile/08078976493778131361noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-71776638072094619162009-03-07T16:46:00.000-08:002009-03-07T16:46:00.000-08:00Glad it helped :)This was not a well explained pos...Glad it helped :)<BR/><BR/>This was not a well explained post at all. I just posted it for future reference, and just in case anyone else could use it.<BR/><BR/>Thanks a lot for letting me know about the bug, I hadn't even noticed it yet :O (although the people I did this for haven't deployed it yet, which makes it even more useful :) )Clayton Shepardhttps://www.blogger.com/profile/11139128931368750934noreply@blogger.comtag:blogger.com,1999:blog-1985725707144494069.post-81104099009518827602009-03-05T17:52:00.000-08:002009-03-05T17:52:00.000-08:00Thanks so much for this - it's a fantastic piece o...Thanks so much for this - it's a fantastic piece of work. I have noticed one small bug - in the vCard properties in submit.php, you have the first name and last name post fields the wrong way round.<BR/><BR/>Thanks again!Anonymoushttps://www.blogger.com/profile/02803724668002025066noreply@blogger.com