Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.
Gravity PDF v4 will receive bug fixes and security updates until October 4, 2019, however it's recommended you upgrade to v5 as soon as practical.
Jump To Section

Description #description

When provided the Gravity Form entry ID and PDF ID, this method will correctly generate the PDF, save it to disk, trigger the gpdf_post_save_pdf action and return the absolute path to the PDF.

Version #version

This method was introduced in Gravity PDF 4.0.

Parameters #parameters

$entry_id | integer
The Gravity PDF Entry ID
$pdf_id | string
The PDF internal identifier (found in the pid URL parameter when viewing individual PDF settings in the admin area)

Return #return

string | WP_Error
The full path to the generated PDF on success, or a WP_Error on failure

Usage #usage

The following snippet shows you how to generate a PDF and test that it was successful:

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

        $pdf_path = GPDFAPI::create_pdf( 171, '56d5338fae865');

        if ( ! is_wp_error( $pdf_path ) && is_file( $pdf_path ) ) {
            //Do something with your PDF
        }
    }
} );

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