• Resolved ezekielion

    (@ezekielion)


    Customer entered Chinese character in the name and address fields. I am not able to see it on the PDF invoice. It doesn’t display properly. How to solve this?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor Darren Peyou

    (@dpeyou)

    Hey @ezekielion,

    Some languages (Japanese, Chinese, etc.) are not supported by the default font included with the plugin, so a custom font is required. See Using Custom Fonts

    For our paying users we also have a Chinese language pack available that is just a “plug-and-play” solution, no coding required. WordPress does not allow for support of paid software here in the forums, so email us at [email protected] if you are interested in the language pack.

    Thread Starter ezekielion

    (@ezekielion)

    I copied all the files from wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/Simple to the child theme. I tried the custom fonts. It didn’t work. Added to the style.css

    /* Load font */
    @font-face {
    font-family: 'NotoSansTC-Regular';
    font-style: normal;
    font-weight: normal;
    src: local('NotoSansTC-Regular'), local('NotoSansTC-Regular'), url(get_template_path(); ?>/fonts/NotoSansTC-Regular.ttf) format('truetype');
    }
    @font-face {
    font-family: 'NotoSansTC-Regular';
    font-style: normal;
    font-weight: bold;
    src: local('NotoSansTC-Regular Bold'), local('NotoSansTC-Regular-Bold'), url(get_template_path(); ?>/fonts/NotoSansTC-Regular-bold.ttf) format('truetype');
    } body {
    background: #fff;
    color: #000;
    margin: 0cm;
    font-family: ‘NotoSansTC-Regular’;
    /* want to use custom fonts? https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/using-custom-fonts/ / font-size: 9pt; line-height: 100%; / fixes inherit dompdf bug */
    overflow-wrap: anywhere;
    }

    and Enabled font subsetting.

    Chose “chinese” under Choose a Template.

    PDF still shows squares wherever there is Chinese characters.

    Plugin Contributor dwpriv

    (@dwpriv)

    Your URL path in the scr property have incomplete syntax. They are missing the echo action. Try this:

    src: local('NotoSansTC-Regular'), local('NotoSansTC-Regular'), url(<?php echo get_template_path(); ?>/fonts/NotoSansTC-Regular.ttf) format('truetype');
    src: local('NotoSansTC-Regular Bold'), local('NotoSansTC-Regular-Bold'), url(<?php echo get_template_path(); ?>/fonts/NotoSansTC-Regular-bold.ttf) format('truetype');
    Thread Starter ezekielion

    (@ezekielion)

    Got 200: parsererror

    /* Load font */
    @font-face {
    font-family: 'NotoSansTC-Regular';
    font-style: normal;
    font-weight: normal;
    src: local('NotoSansTC-Regular'), local('NotoSansTC-Regular'), url(/fonts/NotoSansTC-Regular.ttf) format('truetype'); }
    @font-face {
    font-family: 'NotoSansTC-Regular';
    font-style: normal;
    font-weight: bold;
    src: local('NotoSansTC-Regular Bold'), local('NotoSansTC-Regular-Bold'), url(/fonts/NotoSansTC-Regular-bold.ttf) format('truetype');
    } body {
    background: #fff;
    color: #000;
    margin: 0cm;
    font-family: ‘NotoSansTC-Regular’;
    /* want to use custom fonts? https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/using-custom-fonts/ / font-size: 9pt; line-height: 100%; / fixes inherit dompdf bug */
    overflow-wrap: anywhere;
    }
    Plugin Contributor dwpriv

    (@dwpriv)

    The src property seems to be missing the code that gets the template path. Could you add it like I had show before and let us know if it works?

    Thread Starter ezekielion

    (@ezekielion)

    Yes, this was the same code I entered. When I pasted it, this comment area removed the echo line when I pasted the whole thing. This is the individual line

    src: local('NotoSansTC-Regular'), local('NotoSansTC-Regular'), url(<?php echo get_template_path(); ?>/fonts/NotoSansTC-Regular.ttf) format('truetype');

    The second one

    src: local('NotoSansTC-Regular Bold'), local('NotoSansTC-Regular-Bold'), url(<?php echo get_template_path(); ?>/fonts/NotoSansTC-Regular-bold.ttf) format('truetype');

    and got 200: parsererror

    Plugin Contributor dwpriv

    (@dwpriv)

    Could you share a link to download the fonts, so that I can try them on my setup, please?

    Thread Starter ezekielion

    (@ezekielion)

    Plugin Contributor dwpriv

    (@dwpriv)

    Thanks for the link. I’ve been able to load the font in a custom template without issue: https://ibb.co/zs7dvg0

    My CSS code:

    @font-face {
        font-family: "NotoSansTC";
        font-style: normal;
        font-weight: normal;
        src: local("NotoSansTC Regular"), local("NotoSansTC-Regular"), url(<?php echo $this->get_template_path(); ?>/fonts/NotoSansTC-Regular.ttf ) format("truetype");
    }
    @font-face {
        font-family: "NotoSansTC";
        font-style: lighter;
        font-weight: lighter;
        src: local("NotoSansTC Lighter"), local("NotoSansTC-Lighter"), url(<?php echo $this->get_template_path(); ?>/fonts/NotoSansTC-Light.ttf) format("truetype");
    }
    @font-face {
        font-family: "NotoSansTC";
        font-style: bold;
        font-weight: bold;
        src: local("NotoSansTC Bold"), local("NotoSansTC-Bold"), url(<?php echo $this->get_template_path(); ?>/fonts/NotoSansTC-Bold.ttf) format("truetype");
    }
    
    body {
        background: #fff;
        color: #000;
        margin: 0cm;
        font-family: "NotoSansTC";
        /* want to use custom fonts? https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/using-custom-fonts/ */
        font-size: 9pt;
        line-height: 100%; /* fixes inherit dompdf bug */
        overflow-wrap: anywhere;
    }

    Perhaps the error you have is related to some other issue in your template? Do you find any errors in your logs as outlined here? You’re looking for logs prefixed with wpo-wcpdf or fatal_error

    Thread Starter ezekielion

    (@ezekielion)

    @font-face {
        font-family: 'NotoSansTC';
        font-style: normal;
        font-weight: normal;
    	src: local('NotoSansTC Regular'), local('NotoSansTC-Regular'), url(<?php echo get_template_path(); ?>/fonts/NotoSansTC-Regular.ttf) format('truetype');
    	
    }
    @font-face {
        font-family: 'NotoSansTC';
        font-style: normal;
        font-weight: bold;
        src: local('NotoSansTC Regular Bold'), local('NotoSansTC-Regular-Bold'), url(<?php echo get_template_path(); ?>/fonts/NotoSansTC-Regular-bold.ttf) format('truetype');
    }
    
    body {
    	background: #fff;
    	color: #000;
    	margin: 0cm;
    	font-family: ‘NotoSansTC’;
    	/* want to use custom fonts? https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/using-custom-fonts/ */
    	font-size: 9pt;
    	line-height: 100%; /* fixes inherit dompdf bug */
    	overflow-wrap: anywhere;
    }
    
    

    What is wrong with this code?

    I had an error log when I copied style.css to the original folder. I have since reversed it.

    2023-12-26T15:33:43+00:00 CRITICAL Fatal error: Call to undefined function get_template_path() (/var/www/vhosts/ezekiel-ion.com/httpdocs/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/Simple/style.css:13)

    Line 13 is

    src: local('NotoSansTC Regular'), local('NotoSansTC-Regular'), url(<?php echo get_template_path(); ?>/fonts/NotoSansTC-Regular.ttf) format('truetype');
    • This reply was modified 11 months ago by ezekielion.
    • This reply was modified 11 months ago by ezekielion.
    Plugin Contributor dwpriv

    (@dwpriv)

    It’s related to how the get_template_path function is called. It has to be written like so: $this->get_template_path() the $this-> needs to be prefixed onto the function. So your full code should look like so:

    url(<?php echo $this->get_template_path(); ?>/fonts/NotoSansTC-Regular.ttf ) format("truetype");
    Thread Starter ezekielion

    (@ezekielion)

    OK. I copied exactly your code over and the error is gone. It seems to display now. Thank you!

    Plugin Contributor dwpriv

    (@dwpriv)

    No problem ??

    I will mark this topic as resolved.

    Also, if you don’t mind and have the time, do you think you could leave us a review on www.remarpro.com or on Trustpilot?

    Thanks in advance and all the best with the store!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Unable to see and print Chinese in PDF’ is closed to new replies.