Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.

Jump To Section

Description #description

This method will return an array containing all the PDFs configured on a particular Gravity Form. If you want an individual PDF settings see GPDFAPI::get_pdf().

Version #version

This method was introduced in Gravity PDF 4.0.

Parameters #parameters

$form_id | integer
The Gravity Form ID

Return #return

array | WP_Error
An array of the PDFs will be returned on success, otherwise a WP_Error object on failure

Usage #usage

This snippet will show you how to get the current list of PDFs setup on a particular Gravity Form and loop through the results:

add_action( 'init', function() {
    if ( class_exists( 'GPDFAPI' ) ) {

        /* Get a list of PDFs assigned to form #2 */
        $pdfs  = GPDFAPI::get_form_pdfs( 2 );

        if ( ! is_wp_error( $pdfs ) && sizeof( $pdfs ) > 0 ) {
            echo '<ul>';

            /* Loop through and output the PDF name field in a list */
            foreach ( $pdfs as $pdf ) {
                echo '<li>' . $pdf['name'] . '</li>';
            }

            echo '</ul>';
        }
    }
} );

Source Code #source-code

This method is located in api.php.

Signup for the latest Gravity PDF news, tips and updates

  • This field is for validation purposes and should be left unchanged.
Scroll To Top

Choose your currency:

Close
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 (¥)