Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.
This is the legacy Gravity PDF v4 documentation which is NOT supported. Go to the latest documentation.
Jump To Section

Description #description

This filter can be used to programically enable or disable a PDF configured on the form. By default, Gravity PDF will check if the PDF status is active and the conditional logic is valid. This hook allows you to filter PDFs with advanced logic.

Version #version

This filter was introduced in Gravity PDF 4.2.

Parameters #parameters

$filtered | array
The filtered list of PDF settings
$pdfs | array
The unfiltered list of PDF settings
$entry | array
The raw Gravity Form Entry array.
$form | array
The Gravity Forms array

Usage #usage

Use the following code to enable the form’s PDFs if two sets of conditions are true (something you cannot do with standard Gravity Forms conditional logic), otherwise disable the documents:

add_filter( 'gfpdf_get_active_pdfs', function( $filtered, $pdfs, $entry, $form ) {

    if ( ( $entry[1] === 'Australia' || $entry[1] === 'New Zealand' ) && $entry[2] === 'Married' ) {
        return $pdfs;

    return [];
}, 10, 3 );

Source Code #source-code

This filter is located in the Model_PDF::get_active_pdfs() method in /src/model/Model_PDF.php.

Signup for the latest Gravity PDF news, tips and updates

  • This field is for validation purposes and should be left unchanged.
Gravity PDF 40K Active Installs Celebration! Take 20% off any products with coupon 40KMILESTONE (this week only)Visit Store
+ +
Scroll To Top

Choose your currency:

Converted prices are for reference only - all orders are charged in $ Australian Dollars ($) AUD.
  • AUDAustralian Dollars ($)
  • USDUS Dollars ($)
  • CADCanadian Dollars ($)
  • EUREuros (€)
  • GBPPound Sterling (£)
  • NZDNew Zealand Dollar ($)
  • JPYJapanese Yen (¥)