• Resolved alena353

    (@alena353)


    Hi,

    I was wondering if there is a way to make the header of the first page to appear on every page of the PDF file?

    Thanks,
    Alyona

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Jensen

    (@dkjensen)

    @alena353

    Hello

    This feature is not currently enabled out of the box. But if you wanted to code your own header using HTML, you can start with this code snippet which will add the given HTML to all page headers: (place in child theme functions.php)

    add_filter( 'wc_cart_pdf_mpdf', function( $mpdf ) {
    	ob_start();
    	?>
    
    	<h1>Header</h1>
    
    	<?php
    	$html = ob_get_clean();
    
    	$mpdf->SetHTMLHeader( $html );
    
    	return $mpdf;
    } );

    After adding your new HTML header, you will likely want to remove the header from the first page that comes by default, you can remove it by copying the PDF template from the plugin folder wc-cart-pdf/templates/cart-table.php into your child theme folder child-theme/woocommerce/wc-cart-pdf/cart-table.php.

    From there you can modify the PDF template in your child theme.

    Let me know if this helps

    Thread Starter alena353

    (@alena353)

    @dkjensen thank you so much! It works perfectly!

    Plugin Author David Jensen

    (@dkjensen)

    @alena353 Great!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show header on every page’ is closed to new replies.