PDF for GravityView 0.8: New Developer API

Featured Image for the blog post "PDF for GravityView 0.8 Update"

We’ve released PDF for GravityView 0.8, which includes a new developer API for generating View PDFs programmatically. The API also allows you to easily get the View PDF Settings. We’ve also squashed a bug that caused a PHP error when rendering survey fields in the PDF. Make sure to update your plugin to avoid any potential issues.

Using the API

Much like Gravity PDF Core’s API, we’ve introduced a new PHP class called PDFGV_API that makes it simple to do common tasks. Refer to the PDF for GravityView documentation for more details about using the API.

Generate a PDF

This method allows you to generate and save a temporary Single Layout View PDF to disk, or stream it directly to the current user. It can be used anytime after the init hook has fired.

				
					add_action( 'wp', function() {
   $view_id  = 120;
   $entry_id = 20;

   $temporary_pdf_path = \PDFGV_API::create_single_entry_pdf( $view_id, $entry_id );
   
   if ( ! is_wp_error( $temporary_pdf_path ) ) {
       // do something with the PDF
   }
} );

				
			

Get Settings

This method allows you to retrieve an array of the Single Layout View PDF settings.

				
					add_action( 'init', function() { 
    $view_id = 120; 
    
    $settings = \PDFGV_API::get_single_entry_pdf_settings( $view_id );
    
    if ( ! is_wp_error( $settings ) ) {
        // do something with the settings
    } 
} );
				
			

How to Update the PDF for GravityView Add-on

If you’ve an active license key for PDF for GravityView, this update is available via WordPress One-Click Updates. Alternatively, you can also download the plugin from your GravityPDF.com account and install it manually from your WordPress admin area, via File Upload or FTP. If you have any questions or need assistance, please reach out to our friendly support team.

We want to thank all the users for reporting these issues. It’s your direct feedback that makes Gravity PDF grow bigger and better.

Don't have one yet?
Purchase PDF for GravityView, and start PDFing your Views in no time.

Changelog

New Feature

  • Add API class for developers to easily generate View PDFs, and get View Settings

Bug Fixed

  • Fix PHP error when rendering survey fields in the PDF while the Gravity Forms Survey add-on is not active
Stay on top!
Never miss out on the latest news and updates in Gravity PDF land. Subscribe to our newsletter now!