Use custom page size/orientation

The default paper size settings of the WooCommerce PDF Invoices & Packing Slips plugin are limited to portrait A4 & Letter. This is because it would be impossible to create a template that looks good on all page sizes.

If you want to use a different page size (perhaps with your own custom template), you can override these settings with two filters:

Page size #

You can use a custom page size by adding the following code to your themes functions.php (read this if you have not done this before!)

To use A5 for packing slip (remove the if statement to use for all PDF documents):

add_filter( 'wpo_wcpdf_paper_format', 'wcpdf_a5_packing_slips', 10, 2 );
function wcpdf_a5_packing_slips($paper_format, $template_type) {
    if ($template_type == 'packing-slip') {
        $paper_format = 'a5';
    }
 
    return $paper_format;
}

To define a custom page size in inch:

add_filter( 'wpo_wcpdf_paper_format', 'wcpdf_custom_inch_page_size', 10, 2 );
function wcpdf_custom_inch_page_size($paper_format, $template_type) {
    // change the values below
    $width = 5.5; //inches!
    $height = 8.5; //inches!
 
    //convert inches to points
    $paper_format = array( 0, 0, $width * 72, $height * 72 );
 
    return $paper_format;
}

or in millimeters (mm):

add_filter( 'wpo_wcpdf_paper_format', 'wcpdf_custom_mm_page_size', 10, 2 );
function wcpdf_custom_mm_page_size($paper_format, $template_type) {
    // change the values below
    $width = 150; //mm!
    $height = 300; //mm!
 
    //convert mm to points
    $paper_format = array( 0, 0, ($width/25.4) * 72, ($height/25.4) * 72 );
 
    return $paper_format;
}

Landscape page orientation #

Use the following filter to change the orientation to landscape:

add_filter( 'wpo_wcpdf_paper_orientation', 'wcpdf_landscape', 10, 2 );
function wcpdf_landscape($paper_orientation, $template_type) {
    // use $template type ( 'invoice' or 'packing-slip') to set paper oriention for only one document type.
    $paper_orientation = 'landscape';
    return $paper_orientation;
}