TOPIC:

Download PDF summary after filling the form 3 years 8 months ago #224884

  • Topic Author
  • Lavyd
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
Hi,

Is it possible to download a pdf summary of a form after filling the form (before or after sending)?

If possible, how can I implement this on my form?

Thanks.

Please Log in or Create an account to join the conversation.

Download PDF summary after filling the form 3 years 8 months ago #224944

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

Yes, there is a possibility to do so.
You can have a download pdf button on the thank you page.
Please take a look at this article crosstec.org/en/downloads/free/form-apps...-thank-you-page.html .
You can try to fill in the form and you'll see that on the thank you page there is a possibility to download pdf summary of just submitted form.

Let me know if this is what you wanted.
If you need help with implementing this to your form, feel free to ask.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

Download PDF summary after filling the form 3 years 8 months ago #225039

  • Topic Author
  • Lavyd
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
This is exactly what I wanted. Two things though:

1. How do I get it to my almost-completed form without (I need help implementing it to my form)

2. How can I customize the pdf not to have the header info? (id, IP, browser and operating system etc)

Thank you

Please Log in or Create an account to join the conversation.

Download PDF summary after filling the form 3 years 8 months ago #225113

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

Here are the instructions on how to do so:
1. To implement this to your form follow these steps:
1) Go to your Form > Advanced tab > More options > Submit Pieces > End Submit, select Type Custom and paste in this piece of code:
global $ff_compath;

        $file = JPATH_SITE . '/administrator/components/com_breezingforms/pdftpl/' . $this->formrow->name . '_pdf_attachment.php';
        if (!JFile::exists($file)) {
            $file = JPATH_SITE . '/administrator/components/com_breezingforms/pdftpl/pdf_attachment.php';
        }

        $processed = array();
        $xmldata = array();

        $_xmldata = $this->xmldata;
        
        foreach ($_xmldata as $data) {
            $xmldata[] = $data;
        }

        ob_start();
        require($file);
        $c = ob_get_contents();
        ob_end_clean();

        require_once(JPATH_SITE . '/administrator/components/com_breezingforms/libraries/tcpdf/tcpdf.php');
        $pdf = new TCPDF();
        $pdf->setPrintHeader(false);
        $pdf->AddPage();
        $pdf->writeHTML($c);
        mt_srand();
        $pdfname = $ff_compath . '/exports/download-pdf-' . date('YmdHis') . '-' . mt_rand(0, mt_getrandmax()) . '.pdf';
        $pdf->lastPage();
        $pdf->Output($pdfname, "F");

        JFactory::getSession()->set('breezingforms.pdf.download', $pdfname);

2) Go to your Form > Advanced tab > More options > Form Pieces > After Form, select Type Custom and paste in this piece of code:
if( JRequest::getInt( 'ff_status', -1 ) == 0 ){
  echo '<script type="text/javascript">
<!--
document.getElementById("pdf_download").innerHTML = \'<a href="'.JURI::root(true).'/components/com_breezingforms/exports/'.basename(JFactory::getSession()->get('breezingforms.pdf.download', '')).'">DOWNLOAD PDF</a>\';  
//->
</script>';
}

3) Go to the last page of your form (Thank you page) and in the Page Properties click on Edit under Intro.
Then click on Tools > Source code and paste in this:
<p>Thank you for your submission. Here you can download the summary of your submission as PDF</p>
<div id="pdf_download"> </div>
In the code above you can change the message. The important thing is not to erase:
<div id="pdf_download"> </div>
That will do the trick.

2. Regarding the question on how to customize the pdf, the answer is to change the pdf email template, because that is the template for pdf shown here. You have to go to /administrator/components/com_breezingforms/pdftpl and create there file named formname_pdf_attachment.php
NOTE: Replace formname with the Name of your form.
Put in that file this code
<?php

defined('_JEXEC') or die('Direct Access to this location is not allowed.');
// IMPORTANT!
// Supported Tags: h1, h2, h3, h4, h5, h6, b, u, i, a, img, p, br, strong, em, font, blockquote, li, ul, ol, hr, td, th, tr, table, sup, sub, small
?>
<table border="1" width="100%">
	
	<?php
	if (count($xmldata)){
		foreach ($xmldata as $data) {
			?>
			<tr>
				<td>
					<strong><?php echo wordwrap(htmlentities($data[_FF_DATA_TITLE], ENT_QUOTES, 'UTF-8'), 40, '<br />', true); ?>:</strong>
				</td>
				<td>
					<?php echo $data[_FF_DATA_TYPE] == 'Signature' && file_exists(JPATH_SITE.'/media/breezingforms/signatures/'.$data[_FF_DATA_VALUE]) ? '<img src="'.JPATH_SITE.'/media/breezingforms/signatures/'.$data[_FF_DATA_VALUE].'" />' : nl2br(htmlentities(substr(is_array($data[_FF_DATA_VALUE]) ? implode('|',$data[_FF_DATA_VALUE]) : $data[_FF_DATA_VALUE],0,10000), ENT_QUOTES, 'UTF-8')); ?>
				</td>
			</tr>
			<?php
		}
	}
	?>
</table>
The code above creates a template for pdf so you can change it to whatever suits you.
Let me know if you have managed to set this for your form and if you have more questions, feel free to ask.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

Download PDF summary after filling the form 3 years 8 months ago #225150

  • Topic Author
  • Lavyd
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
Works well so far. Thank you.

I'm a bit lost on how to include the section titles on the pdf?

Is it possible?

Thanks

Please Log in or Create an account to join the conversation.

Download PDF summary after filling the form 3 years 8 months ago #225225

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

Great that you've managed to set this for your form.

Unfortunately, there is no such option for passing section names to emails, pdf etc., but there is one solution I can offer you.
You can create a hidden input element as the first element of the section. Set his value as the name of the section. That way you will always have the name of the section displayed above elements in manage records, emails, pdf etc. The user won't see it in the frontend.
Let me know if this is an appropriate solution for you.

Another solution would be to add section names manually to the pdf template but that would require some coding.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!