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 allows you to update an existing PDF’s settings. If you are using data provided by the user ensure you validate and sanitize everything as we don’t do it for you.

Version #version

This method was introduced in Gravity PDF 4.0.

Parameters #parameters

$form_id | integer
The Gravity Form ID
$pdf_id | string
The PDF internal identifier (found in the pid URL parameter when viewing individual PDF settings in the admin area)
$settings | array
The PDF settings you are updating to. This settings array will replace ALL current PDF settings.

Return #return

boolean
True on success, false on failure

Usage #usage

The following snippet shows you how to retrieve a PDF’s existing settings and update the name:

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

        /* Get the individual PDF config */
        $pid = '56c14c955d989';
        $pdf  = GPDFAPI::get_pdf( 2, $pid );

        $pdf['name'] = 'New PDF Name';

        if( GPDFAPI::update_pdf( 2, $pid, $pdf ) ) {
            //PDF updated successfully
        }
    }
} );

For the full list of settings available see the form_settings, form_settings_appearance and form_settings_advanced arrays in the Helper_Options_Fields::get_registered_fields() method.

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