Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Landscape orientation for invoice

  • Resolved Vivek Athalye

    (@vnathalye)


    Is there a way to change the page orientation for the generated PDF? I would like to set it to landscape mode but could not find any easy way.

    If there is no direct way currently present, here is what I propose:
    In wcpdf-functions.php we have following function:

    function wcpdf_get_pdf_maker( $html, $settings = array() ) {
    	if ( ! class_exists( '\\WPO\\WC\\PDF_Invoices\\PDF_Maker' ) ) {
    		include_once( WPO_WCPDF()->plugin_path() . '/includes/class-wcpdf-pdf-maker.php' );
    	}
    	$class = apply_filters( 'wpo_wcpdf_pdf_maker', '\\WPO\\WC\\PDF_Invoices\\PDF_Maker' );
    	return new $class( $html, $settings );
    }

    In this function just before returning the PDF_Maker object, apply filter wpo_wcpdf_pdf_maker_settings which will allow modifications to $settings array.

    Later on you can add the setting in UI as well.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Landscape orientation for invoice’ is closed to new replies.