• Resolved anindaorada

    (@anindaorada)


    I wanted to print the pdf via thermal printer. Even though I put the following code lines into my functions php childe theme section, it still seems on a4 format.What am I supposed to do ?

    Code goes to functions php child theme

    add_filter( ‘wpo_wcpdf_paper_format’, ‘wcpdf_custom_mm_page_size’, 10, 2 );
    function wcpdf_custom_mm_page_size($paper_format, $template_type) {
    // change the values below
    $width = 250; //mm!
    $height = 300; //mm!

    //convert mm to points
    $paper_format = array( 0, 0, ($width/25.4) * 72, ($height/25.4) * 72 );

    return $paper_format;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hello @anindaorada,

    Try using this code instead in order to custom the page size:

    add_filter( 'wpo_wcpdf_paper_format', 'wcpdf_custom_mm_page_size', 10, 2 );
    function wcpdf_custom_mm_page_size($paper_format, $template_type) {
    	// change the values below
    	$width = 250; //mm!
    	$height = 300; //mm!
    	
    	//convert mm to points
    	$paper_format = array( 0, 0, ($width/25.4) * 72, ($height/25.4) * 72 );
    	
    	return $paper_format;
    }

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Let me know if works!

    Thread Starter anindaorada

    (@anindaorada)

    Thanks so much it works but altough I monitor location,payment method and quantity by opening it up in different page,I can not see it in the slip I printed. Can you help me with it ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom filter for thermal printer’ is closed to new replies.