How do I change common PDF options?

In order to change the more common options for your PDFs, simply add the following action to your themes functions.php

function custom_bewpi_mpdf_options( $options ) {
    $options['mode'] = '';
    $options['format'] = ''; // use [format]-L or [format]-P to force orientation (A4-L will be size A4 with landscape orientation)
    $options['default_font_size'] = 0;
    $options['default_font'] = 'opensans';
    $options['margin_left'] = 14;
    $options['margin_right'] = 14;
    $options['margin_top'] = 14;
    $options['margin_bottom'] = 0;
    $options['margin_header'] = 14;
    $options['margin_footer'] = 6;
    $options['orientation'] = 'P'; // Also try to force with format option

    return $options;
add_filter( 'bewpi_mpdf_options', 'custom_bewpi_mpdf_options' );

Please test the functionality on a development environment of your website. If it ceases to work, please revert back to the original state of your website and follow the tutorial again.

Still need help? Contact Us Contact Us