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 dynamically change or add to a form’s PDF settings. For a permanent way to set the PDF settings you should use the GPDFAPI::update_pdf() method instead.

You also have the option to use the gfpdf_pdf_config_$form_id filter.

Parameters #parameters

$settings | array
The current PDF settings being processed

Usage #usage

This snippet shows you how you can easily update all your forms from a legacy v3 template to a v4 template, without having to manually change the settings in the UI.

add_action( 'gfpdf_pdf_config', function( $settings, $form_id ) {

    /* Change from the legacy v3 template to a v4 template */
    if( 'default-template' === $settings['template'] ) {
        $settings['template'] = 'zadani';

    return $settings;

}, 10, 2 );

While the PDF master password setting has been removed from the UI, you can manually set this using the following snippet:

add_action( 'gfpdf_pdf_config', function( $settings, $form_id ) {

    /* When security is on we'll use our own master password instead of a random one */
    if( $settings['security'] === 'Yes' ) {
        $settings['master_password'] = 'my password'; /* change this to a secure password */

    return $settings;

}, 10, 2 );

You can also specifically target a form:

add_action( 'gfpdf_pdf_config_2', function( $settings ) { }, 10 );

Source Code #source-code

This filter is located in the Helper_Abstract_Options::get_pdf() method of /src/helper/abstract/Helper_Abstract_Options.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 (¥)