gravityflowpdf_content

The gravityflowpdf_content filter is used to modify the contents the PDF Generator add-on defines via the step settings template before generating the PDF. 

Parameters

Parameter Type Definition
$body Array The markup the template from step settings produced with current entry values.
$file_path Array Where the PDF will be generated upon successful completion of the step.
$entry Array The current entry array.
$step Gravity_Flow_Step The current step.

Examples

Example-1  - Add a custom heading above the PDF template content

add_filter( 'gravityflowpdf_content', 'sh_pdf_content_modify', 10, 4 );
function sh_pdf_content_modify( $body, $file_path, $entry, $step ) {
    $body = '<h1>Inserting a custom title before template content</h1>' . $body;
    return $body;
}

Example-2  - Prevent the {all_fields} merge tag from shrinking all the text in the table for long tables.

add_filter( 'gravityflowpdf_content', 'sh_pdf_content_modify', 10, 4 );
function sh_pdf_content_modify( $body, $file_path, $entry, $step ) {
    $body = str_replace( '<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA"><tr><td>', '', $body );
    	$body = str_replace( "</td>\r\n                   </tr>\r\n               </table>", '', $body );

    	return $body;
    return $body;
}

Placement

This code should be placed in the functions.php file of your active theme.