gravityflowpdf_generated

The gravityflowpdf_generated action allows customization to occur immediately after the successful generation of the PDF file on the server. 

Parameters

Parameter Type Definition
$file_name String The file name of the newly generated PDF file.
$entry_id Integer The entry ID for which the PDF step was processed.
$form_id Integer The form ID for which the entry was submitted.


Examples

Example 1 - Create a copy of the PDF file with a custom name in the same folder

add_action( 'gravityflowpdf_generated', 'sh_gravityflowpdf_generated', 10, 3 );
function sh_gravityflowpdf_generated( $file_name, $entry_id, $form_id ) {
    $copied_file_name = 'my-file-abcd.pdf';
    $file_path = gravity_flow_pdf()->get_destination_folder();
    $source_file_path = gravity_flow_pdf()->get_file_path( $entry_id, $form_id );
    $target_file_path = $file_path . $copied_file_name;
    copy( $source_file_path, $target_file_path );
}

Placement

This code should be placed in the functions.php file of your active theme or in a custom functions plugin.