Skip to main content
Version: v6

PDF Invoice Hooks – gfpdf_post_invoice_html

Description

Use this action to dynamically insert content into the PDF Invoice after all other content.

Arguments

The following arguments are passed to functions that use this hook:

$args | array

  • Contains an array of all variables passed into the PDF template, including 'form' 'entry' 'form_data' 'settings' 'fields' 'config'

Usage

Add HTML to the bottom of every PDF Invoice across every form:

add_action( 'gfpdf_post_invoice_html', function( $args ) {
?>
<p>A paragraph of text to be included at the end of every PDF Invoice for all forms.</p>
<?php
} );

Add HTML to the bottom of every PDF Invoice on a specific form:

add_action( 'gfpdf_post_invoice_html', function( $args ) {
if ( (int) ( $args['form']['id'] ?? 0 ) !== 20 ) {
return;
}

?>
<p>A paragraph of text to be included at the end of every PDF Invoice for a specific form.</p>
<?php
} );

Source Code

This hook can be found in the associated Invoice PDF template file, which is located in the PDF Working Directory.