wsf_action_pdf_paper_sizePRO

This add-on is included with the Agency edition. Users of other WS Form PRO editions can also purchase this add-on separately.
Add-ons require WS Form PRO and are not compatible with the WS Form LITE edition.

Description

The wsf_action_pdf_paper_size filter hook allows you to customize the paper size of a PDF when it is generated.

Usage

add_filter( 'wsf_action_pdf_paper_size', 'my_hook_function', 10, 4 );

Parameters

  1. $paper_size String
    The paper size, e.g. letter or a4.
    Default value: The paper size configured in WS Form > Settings > PDF
  2. $form Form Object
    The form object.
  3. $submit Submit Object
    The submit object.
  4. $template String
    The custom PDF template name. Blank if not used.

Example

// Callback function for the wsf_action_pdf_paper_size filter hook
function my_hook_function( $paper_size, $form, $submit, $template ) {
    
    // Only change paper size for form ID 123
    if ( $form->id != 123 ) {

         return $paper_size;
    }

    // Set the paper size to A4 for form ID 123
    return 'a4';
}

// Add a callback function for the wsf_action_pdf_paper_size filter hook
add_filter( 'wsf_action_pdf_paper_size', 'my_hook_function', 10, 4 );

 

Source File

This hook can be found in: <plugin root>/ws-form-pdf.php