PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

FPDF & GF - Send a PDF to form as an attachment??

  1. I have a page that allows you to create a pdf and download it using FPDF. I've also created a (Gravity) form that would allow one to send that PDF to someone. Currently, one has to download and attach the PDF to the form; but what I would like to do, is have the PDF attach itself to the form.

    The Page:
    http://peteryang.com/v02/create-pdf/

    The Form:
    http://peteryang.com/v02/pdf-share/

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink
  2. This is the execution script:

    http://chopapp.com/#ijbc6oyq

    And, trigger script:

    http://chopapp.com/#a9lnaovu

    If you need to see the full script let me know :)

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink
  3. I may be a little confused as to what you are trying to accomplish, what you have already done and what part you need assistance with based on your 2 posts above.

    Let me see if I understand...

    1) You have a bunch of PDF's that get generated.
    2) You want a user to be able to select a PDF and fill out a form
    3) When the user submits the form, the PDF is included with the form data and email notifications

    Does this pretty much sum it up or am I missing some things?

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink
  4. 1.) Currently, the visitor can generate a pdf on the fly by clicking "Download PDF", but I want . . .

    2.) The visitor to be able to click on "Share PDF" to generate the PDF on the Fly and rather than downloading, the PDF is sent to the form and attached (all in one event). The visitor can then complete the form and submit.

    3.) Your #3 is correct

    Thanks for your time Carl.

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink
  5. If you generate the PDF's in a location that is accessible via http:// you could pass the path to the generated PDF to the page containing the form via the query string when you redirect to the page containing the form.

    Ex. user clicks on "Share PDF" link, PDF is generated and use is redirected to http://mysite.com/myform?pdf=/path/to/pdf.pdf

    Then you could configure a hidden field on your form, give it a field label of "PDF" or "Download PDF" and select the advanced tab and set it to be dynamically populated and then use the parameter name you use in the query string to pass the location of the PDF. In my example above the parameter would be "pdf" without the double quotes and save the form.

    Ex. see this screenshot: http://dl.dropbox.com/u/185347/Slingshot/Pictures/Screen%20Shot%202011-12-06%20at%205.16.37%20PM.png

    Now if you pass ?pdf=/path/to/file.pdf to the page containing the form that hidden field you added will be populated with whatever pdf= in the query string.

    Now you have stored the value of the dynamically generated PDF as part of the form data and can display it in email notifications, the confirmation, etc. using that fields merge tag to output it's value.

    Because that field only contains a string and doesn't know it should be formatted as a link, wherever you output the merge tag to display the link to the PDF you can simply go a step further and include all the markup to turn it into a link.

    So instead of this (note these merge tags are examples, merge tags are unique to each form as the id's are dynamic):

    {My hidden PDF field:5}

    You could do this:

    <a href="{My hidden PDF field:5}">Download PDF</a>

    Or this:

    <a href="{My hidden PDF field:5}">{My hidden PDF field:5}</a>

    The first example would just output the value of the field which wouldn't be clickable as a link if it's displayed in HTML. The 2nd and 3rd examples would output it with markup to make it a link with the 2nd example using static link text and the 3rd example using the fields value again as the link text.

    This is just a quick example. A tutorial on how to dynamically populate fields, including the query string method used in this example, can be found here:

    http://www.gravityhelp.com/documentation/page/Using_Dynamic_Population

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink