Change PDF page size (A4, Legal, etc)

The PDF module is available in the PW Gift Cards Pro version only.

For example, to set the PDF to be A4, follow these steps:

1. Download the free Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
2. Create a Snippet with the following code:

Note: You can optionally add this to your functions.php if you’re more familiar with that process instead of using Code Snippets.

function custom_pwgc_mpdf_config( $config ) {
    $config['format'] = 'A4';
    return $config;
}
add_filter( 'pwgc_mpdf_config', 'custom_pwgc_mpdf_config' );
Accepted values for the Format setting are:
  • ‘A4’, ‘Letter’, ‘Legal’, etc
  • ‘A4-L’, ‘Letter-L’, ‘Legal-L’, etc for landscape
  • A string of 2 dimensions e.g. ’21cm 29.7cm’ Can be px, pt, in, mm, cm: but not em, ex or %
Skip to content