Title: Thermal printer template
Last modified: December 15, 2020

---

# Thermal printer template

 *  [ekinmedyanet](https://wordpress.org/support/users/ekinmedyanet/)
 * (@ekinmedyanet)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/thermal-printer-template-2/)
 * Hi, I want to make a thermal printer template. But I need help.
    I want to extend
   the address line. and I want to put the order date and payment method fields 
   under it.
 * now: [https://prnt.sc/w3gqu0](https://prnt.sc/w3gqu0)
    i want to do: [https://prnt.sc/w3gtqo](https://prnt.sc/w3gtqo)
   Thank You !
    -  This topic was modified 5 years, 7 months ago by [ekinmedyanet](https://wordpress.org/support/users/ekinmedyanet/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fthermal-printer-template-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [kluver](https://wordpress.org/support/users/kluver/)
 * (@kluver)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/thermal-printer-template-2/#post-13796430)
 * Hi [@ekinmedyanet](https://wordpress.org/support/users/ekinmedyanet/),
 * I see you’ve already managed to [change the page size](https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/use-custom-page-sizeorientation/).
   To change the fundamental layout of the template you will need to [create a custom template](https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/creating-a-custom-pdf-template/).
   Here you can change the structure of the header.
 * When working with a thermal printer I’m assuming you’ll also need a dynamic page
   height. You could accomplish that with the following code snippet:
 *     ```
       add_filter( 'wpo_wcpdf_paper_format', 'wcpdf_dynamic_page_size', 10, 3 );
       function wcpdf_dynamic_page_size( $paper_format, $document_type, $document ) {
       	// set width & height in mm
       	$width       = 80;
       	$min_height  = 150;
       	$base_height = 140;
       	$height = $base_height;
       	if ( !empty($order = $document->order )) {
       		foreach( $order->get_items() as $item ) {
       			$product = $item->get_product();
       			if( $product->get_type() == 'simple' ) {
       				$height += 12; // adjust for simple products
       			} else {
       				$height += 50; // adjust for variable products ( includes meta )
       			}
       		}
       		$height = max($min_height, $height);
       	} else {
       		$height = $min_height;
       	}
   
       	//convert mm to points
       	$paper_format = array( 0, 0, ($width/25.4) * 72, ($height/25.4) * 72 );
       	return $paper_format;
       }
       ```
   
 * This will add extra millimeters to your page height based on the items in the
   order. This code snippet should be added to the functions.php of your child theme
   or via a plugin like Code Snippets. If you haven’t worked with code snippets 
   or functions.php before please read this: [How to use filters](https://docs.wpovernight.com/general/how-to-use-filters/)
    -  This reply was modified 5 years, 7 months ago by [kluver](https://wordpress.org/support/users/kluver/).

Viewing 1 replies (of 1 total)

The topic ‘Thermal printer template’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [kluver](https://wordpress.org/support/users/kluver/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/thermal-printer-template-2/#post-13796430)
 * Status: not resolved