Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Changing page margins

  • Resolved printplaygames

    (@printplaygames)


    Is there any way I can change the page margins on the standard invoices?
    I am trying to squeeze a few more things into the page and a another half inch would be great top and bottom.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support kluver

    (@kluver)

    Hi @printplaygames,

    You can change the page margins with a small code snippet:

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles' );
    function wpo_wcpdf_custom_styles () {
    	?>
    	@page { 
    		margin-top: 1cm; 
    		margin-right: 1cm; 
    		margin-bottom: 1cm; 
    		margin-left: 1cm; 
    	}
    	<?php
    }

    This code snippet should be placed in the functions.php of your child theme or with a plugin like Code Snippets. If you haven’t worked with code snippets or functions.php before please read this: How to use filters

    Please note that these margins will apply to both invoice and packing slip. If you only want to change the invoice you will have to add some additional padding to your packing slip after reducing the page margins like this:

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles' );
    function wpo_wcpdf_custom_styles () {
    	?>
    	@page { 
    		margin-top: 1cm; 
    		margin-right: 1cm; 
    		margin-bottom: 1cm; 
    		margin-left: 1cm; 
    	}
    
    	.packing-slip { 
    		padding-top: 0cm;
    		padding-right: 1cm;
    		padding-bottom: 2cm;
    		padding-left: 1cm;
    	}
    	<?php
    }
    • This reply was modified 2 months ago by kluver.
    printplaygames

    (@printplaygames)

    Awesome, just what we need.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.