• Resolved whflive

    (@whflive)


    Hi, firstly thanks for this plugin. I have resized the invoice/packaging slip to fit my document size. It mostly works but I cannot find how to lower the margin of these two spaces which are highlighted in red in the attached image.

    1. Space between title/logo + address/order detail section
    2. Space between product heading bar + address/order detail section.

    I lowered margin of h1, h2, etc. with code below to remove most white spaces but cannot work out how to remove these remaining blank spaces.

    /**
     * Custom styles for PDF documents
     */
    add_action( 'wpo_wcpdf_custom_styles', function ( $document_type, $document ) {
    	?>
    	/* Document label */
    	h1 {
    		font-size: 6pt;
    		margin-top: 0px;
    		margin-bottom: 0px;
    		padding-top: 0px;
    		padding-bottom: 0px;
    	}
    	/* Shop name and other labels */
    	h3, h4 {
    		font-size: 6pt;
    		padding-top: 0px;
    		padding-bottom: 0px;
    		margin-top: 0px;
    		margin-bottom: 0px;
    	}
    	/* Document body and order table  */
    	body {
    		font-size: 6pt;
    		padding-top: 0px;
    		padding-bottom: 0px;
    		margin-top: 0px;
    		margin-bottom: 0px;
    	}
    	dt, dd, dd p, .wc-item-meta {
    		font-size: 6pt;
    		padding-top: 0px;
    		padding-bottom: 0px;
    		margin-top: 0px;
    		margin-bottom: 0px;
    	}
    	<?php
    }, 10, 2 );

    Any help would be much appreciated.

    Screenshot: https://i.imgur.com/d6dWwn3.png

    • This topic was modified 2 years, 1 month ago by whflive.
    • This topic was modified 2 years, 1 month ago by whflive.
    • This topic was modified 2 years, 1 month ago by whflive.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @whflive,

    Try adding this extra CSS rule within the code snippet above:

    table.order-data-addresses, table.head {
        margin-bottom: 0;
    }
    Thread Starter whflive

    (@whflive)

    Thanks so much @yordansoares. This did the trick.

    One more thing if I may: How can I bring the order no. & date slightly more to the left?
    Changing right/left margins for the code below did not work.

    	?>
    	.invoice tr.order-number, .invoice tr.order-date {
    		font-size: 6pt;
    		margin-top: 0px;
    		margin-bottom: 0px;
    		padding-top: 0px;
    		padding-bottom: 0px;
    	}

    Shown here: https://i.imgur.com/vpoQF9O.png

    An alternative could be to change “Order Number” to “Order No.” and Date from “21 October 2022” to “21/10/22” if that is possible.

    • This reply was modified 2 years, 1 month ago by whflive.
    Thread Starter whflive

    (@whflive)

    Any help please?

    Plugin Contributor Yordan Soares

    (@yordansoares)

    How can I bring the order no. & date slightly more to the left? Changing right/left margins for the code below did not work.

    This is because the white space in the middle is reserved for the shipping address. If you don’t need it, you can hide it, and increase the order data width, with these CSS rules:

    td.address.shipping-address {
        display: none;
    }
    td.order-data {
        width: 50%;
    }

    An alternative could be to change “Order Number” to “Order No.”

    We don’t have a setting to customize the text on the PDF documents, but you can achieve it with this code snippet:

    /**
     * PDF Invoices & Packing Slips for WooCommerce:
     * Customize texts on the PDF documents (gettext)
     */
    add_filter( 'wpo_wcpdf_html_filters', function( $filters ) {
    	$filters[] = array( 'gettext', 'wpo_wcpdf_customize_string_translation', 999, 3 );
    	return $filters;
    }, 10, 1 );
    function wpo_wcpdf_customize_string_translation( $translation, $text, $domain ) {
    	if ( $domain == 'woocommerce-pdf-invoices-packing-slips' ) {
    		switch ( $text ) {
    			// Repeat as many cases as strings you want to translate
    			case 'Order Number:':
    				$translation = 'Order N°:';
    				break;
    		}
    	}
    	return $translation;
    }

    …and Date from “21 October 2022” to “21/10/22” if that is possible.

    We follow the WordPress date format, that you can set under the WordPress Dashboard Settings > General > Date Format. However, to apply a custom date format only for the PDF document, you can use this code snippet:

    /**
     * PDF Invoices & Packing Slips for WooCommerce:
     * Customize the order date
     */
    add_filter( 'wpo_wcpdf_date_format', 'wpo_wcpdf_date_format', 10, 3 );
    function wpo_wcpdf_date_format( $date_format, $document, $date_type ) {	
    	if( $date_type == 'order_date' ){
    		$date_format = 'd/m/Y';
    	}
    	return $date_format;
    }
    Thread Starter whflive

    (@whflive)

    Perfect, thanks so much Yordan. Great plugin, even better support.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for your kind words, @whflive! ?

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove blank spaces’ is closed to new replies.