SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict jodmcc's Avatar
    Join Date
    Dec 2003
    Location
    Houston, Texas
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Make PDF and Email PDF 1 Submit Button

    I'm putting together a form that when the submit button is clicked, the form will be converted to a PDF and then emailed, but I'm not sure how to go about setting both of these actions to happen. Any help would be greatly appreciated.

    Thanks,
    John

  2. #2
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,746
    Mentioned
    45 Post(s)
    Tagged
    0 Thread(s)
    You'll have to use a programming language to convert the data to a PDF. Something like PHP should work.

    If you just want the form data e-mailed to wherever, you could do something like...


    Code HTML4Strict:
    <form action="mailto:address@hotmail.com">

    ...though that would open you up to getting tonnes of spam mailed to that address.


    What exactly is this for ?

    Are you sure there's no easier solution to the problem ?




    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse

  3. #3
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,761
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Hi

    No don't use the form action to send emails. That opens outlook and some people don't have it. You can use PHP and use the mail function to send the email.

    Cheers.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  4. #4
    Django Jedi neron-fx's Avatar
    Join Date
    Sep 2007
    Location
    Bristol/Bath, UK
    Posts
    274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the PDF generation look into PHP's PDF Lib... I think that PEAR also has one. Not sure on how good they are though.

    I use Java based iReports here at work to generate my PDF's. Just execute a call to the jasper wrapper/server from PHP and Robert is your mother's brother, as they say! BOOM! one PDF
    Neron-Fx
    Everytime a user opens Internet Explorer, a web developer dies...
    http://www.savethedevelopers.org/

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RyanReese View Post
    That opens outlook and some people don't have it.
    It only opens Outlook if you have configured your browser to use Outlook as its email application. If you don't have Outlook, you probably won't have done that.

    Nevertheless, your advice is sound: One shouldn't use mailto links. Not everyone has an email application on their computer. Many use web mail only.
    Birnam wood is come to Dunsinane

  6. #6
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,761
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Hi

    I should rephrase (not to take your remarks off AutisticCuckoo), not all people have accounts on outlook (or the program they configure it to be)

    Cheers.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  7. #7
    SitePoint Addict jodmcc's Avatar
    Join Date
    Dec 2003
    Location
    Houston, Texas
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    I will probably use something like html2pdf, etc., but this is essentially what I have:
    1. Form already put together in Acrobat; would like to use that for online fill and/or print, but had problems in the past with file in browser. Form will have Reset, Print and Submit buttons.

    Want user to have the ability to fill online and then convert to PDF(if using an html form instead) and then for that same PDF to be emailed to one email address.

    or give the user the opportunity to print out the form to be filled offline and mailed by regular mail.

    If using an html form and converting and emailing, I'm not sure how to put the actions in on one submit button that would do both (if entered back to back?). Hope this clears up the original posting.

    John

  8. #8
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,283
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    One thing with HTML forms that are printable is, people can choose to fill them out first and then print (I would do this if I were blind fer sure : ) while others print it blank and fill out with a pen later. The point of printing at all being, they can put it in the post and mail it.

    So, if you write your HTML form correctly you can avoid a "print" buttons as people can just... print like normal. *erm by "correctly" I mean, no select drop-downs etc : )

    For the PDF, is this for people who already have the whole Acrobat suite? Cause crawling through the nasty PDF's at my work (where I don't have any crappy Acrobat products), the text on our website was all like, just fill this in and then mail to us! And it turned out this only worked if you like bought the whole Acrobat Suite for a bazillion dollars or something, couldn't fill them in with just Reader (or Document reader) alone.

    I would have convert-to-pdf be a separate button from the regular submit (the form submit would be the action in the form). I would be afraid to try to have a filled-out-but-not-submitted form turned into a PDF-- so easier to just have a PDF version of the blank form for those who like PDFs. The emailing thing... I still would want that form submitted to a server somewhere first, so that not only can the form be checked for validation (was it filled out correctly and completely?) but then also there's a place to store the information filled in, so that an html-to-pdf program has a place to go get those values.

  9. #9
    SitePoint Evangelist JordashTalon's Avatar
    Join Date
    Dec 2008
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with Stomme, When I do something like this I have two seperate Forms a PDF Form and an HTML form which emails via PHP, I wouldn't bother with the email form being converted into PDF unless you absolutely need it (I would suppose for printing purposes but even then)

  10. #10
    SitePoint Zealot FaridHadi's Avatar
    Join Date
    Nov 2008
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yupp, that seems to be making most sense. Give your users those two options. "Print Form" for those who want to send it by snail mail and "Submit Form" for those who just want to send it online. Skip the PDF conversion. Also, avoid using the mailto method, use a server side script to send the email instead, unless you are OK with getting spammed =)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •