Ninja Froms Custom PDF Template
-
Hello… thanks in advance for any help…
So I have made a large form with Ninja Forms, and a custom PDF template… I copied it need to alter the form and custom PDF template for the slightly different form. I had done a little reading on this and found this piece of advise:
PDF Templates for Each Form
Some people want to have PDF templates for each form. The best way to achieve this is to use one template and use some conditional logic within the template using the $form_ID variable to display different templates.
I was wondering if someone might be able to provide an example of how this would look?
Here is what the start of my custom PDF Export code looks likes
<?php
/**
* PDF Included With Form Submission
*
* @author Patrick Rauland
* @version 1.0.0
*/if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly
?>
<html>
<head>
<link type=”text/css” href=”pdf.css” rel=”stylesheet” />
</head>
<body><header>
<img src=”https://kscsafety.com/wp-content/uploads/2015/11/site-logo.png”/>
</header><div id=”main”>
<div><!– General Info –>
<h1>Site-Specific Safety and Health Plan (SSSP) for project:</h1><p>Please complete this and the following 24 sections to begin the development of your Site Specific Safety Plan. Please save your information as you work through the process. You can stop and restart at any page.</p>
<table width=”100%” cellspacing=”5″ cellpadding=”5″>
<tr>
<td width=”25%” align=”right”><p><b>Project Title:</b> </p></td>
<td width=”25%” align=”left”><p><?php echo $fields[11][‘value’];?> </p></td>
<td width=”25%” align=”right”><p><b>PCN:</b> </p></td>
<td width=”25%” align=”left”><p><?php echo $fields[12][‘value’];?> </p></td>
</tr>
</table><table width=”100%” cellspacing=”5″ cellpadding=”5″>
<tr>
<td width=”25%” align=”right”><p><b>Contract Number:</b> </p></td>
<td width=”25%” align=”left”><p><?php echo $fields[13][‘value’];?> </p></td>
<td width=”25%” align=”right”><p><b>Company Name:</b> </p></td>
<td width=”25%” align=”left”><p><?php echo $fields[14][‘value’];?> </p></td>
</tr>
</table>
- The topic ‘Ninja Froms Custom PDF Template’ is closed to new replies.