Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @mildqqwild

    The reason is that the default font used by the plugin does not support the thai character set.

    You will need to load a custom font by following this documentation page: Using custom fonts

    Hope that helps!

    Thread Starter mildqqwild

    (@mildqqwild)

    Thank you very much,

    I download new font “Prompt” in my folder ” wp-content/fonts

    I also add below code in style.css in my theme child, but it didn’t work. I cannot get Thai language in PDF. Don’t know I miss any.

    thank you for your advise.

    /*Load font*/
    @font-face{
    font-family: ‘Prompt’;
    font-style: normal;
    font-weight: normal;
    src: local (‘Prompt’), local(‘Prompt’), url(<?php echo $this->get_template_path();?>/fonts/prompt.ttf) format(‘truetype’);
    }
    @font-face{
    font-family: ‘Prompt’;
    font-style: normal;
    font-weight: bold;
    src: local (‘Prompt Bold’), local(‘Prompt-Bold’), url(<?php echo $this->get_template_path(); ?>/fonts/prompt-bold.ttf) format(‘truetype’);
    }
    @font-face{
    font-family: ‘Prompt’;
    font-style: italic;
    font-weight: normal;
    src: local(‘Prompt Italic’), local(‘Prompt-Italic’), url(<?php echo $this->get_template_path();?>/fonts/prompt-italic.ttf)format(‘truetype’);
    }
    @font-face{
    font-family: ‘Prompt’;
    font-style: italic;
    font-weigh: bold;
    src: local(‘Prompt Bold Italic’), local(‘Prompt-BoldItalic’), url(<?php echo $this->get_template_path(); ?>/fonts/prompt-bolditalic.ttf) format(‘truetype’);
    }

    body{
    font-family: ‘Prompt’;
    }

    Plugin Contributor Ewout

    (@pomegranate)

    You placed the font in the wrong folder. Instead of wp-content/fonts you should place it in wp-content/themes/YOURTHEME/woocommerce/pdf/YOURTEMPLATE/fonts (where you replace YOURTHEME YOURTEMPLATE with the folder names of your setup)

    Thread Starter mildqqwild

    (@mildqqwild)

    Thank you.
    I moved the font in wp-content/themes/themes-child/woocommerce/pdf/customizedsimple/fonts
    but it still did not work. The Thai character still be square.

    I add the code in style.css in the folder of
    woocommerce/pdf/customizedsimple/simple/style.css

    with the following code;

    /*Load Font*/
    @font-face{
    font-family: ‘Prompt’;
    font-style: normal;
    font-weigh: normal;
    src: local(‘Prompt’), local(‘Prompt’), url(<?php echo $this->get_customizedsimple_path(); ?>/fonts/prompt.ttf) format(‘truetype’);
    }
    @font-face{
    font-family: ‘Prompt’;
    font-style: normal;
    font-weight: bold;
    src: local(‘Prompt Bold’), local(‘Prompt-Bold’), url(<?php echo $this->get_customizedsimple_path(); ?>/fonts/prompt-bold.tff) format (‘truetype’);
    }
    @font-face{
    font-family: ‘Prompt’;
    font-style: italic;
    font-weight: normal;
    src: local(‘Prompt Italic’), local(‘Prompt-Italic’), url(<?php echo $this->get_customizedsimple_path (); ?>/fonts/prompt-italic.tff) format (‘truetype’);
    }
    @font-face{
    font-family: ‘Prompt’;
    font-style: italic;
    font-weight: bold;
    src: local(‘Prompt Bold Italic’), local(‘Prompt-BoldItalic’), url(<?php echo $this->get customizedsimple_path(); ?>/fonts/prompt-bolditalic.tff) format(‘truetype’);
    }

    thank you for your advise.

    Plugin Contributor Ewout

    (@pomegranate)

    There are still two errors here:

    1. You wrote that you put the styles in woocommerce/pdf/customizedsimple/simple/style.css but there’s one level too much in there. Basically you need to copy the Simple template to woocommerce/pdf/ and rename it to customizedsimple, so that the full path would be wp-content/themes/themes-child/woocommerce/pdf/customizedsimple/style.css (and in this folder you would also have invoice.php and the fonts subfolder). I would recommend making a simple change like adding “Hello World” at the top of your invoice.php file in that folder to see if you have correctly setup the custom template before fiddling further with the custom font. Also don’t forget to select the “customizedsimple” template in the General settings of the plugin. I strongly recommend following the guide here: Creating a custom PDF template.
    2. You changed the function name from $this->get_template_path(); to $this->get_customizedsimple_path() this is a non-existing function that will cause the plugin to crash. If it didn’t crash it means the template is not loaded at all (see 1. above)
    Thread Starter mildqqwild

    (@mildqqwild)

    Hi,

    It did not work.

    1. I paste the below code in style.css ;
    /*load font */
    @font-face {
    font-family: ‘Prompt’;
    font-style: normal;
    font-weight: normal;
    src: local(‘Prompt’), local(‘Prompt’), url(<?php echo $this->get_template_path(); ?>/fonts/prompt.ttf) format(‘truetype’);
    }
    @font-face {
    font-family: ‘Prompt’;
    font-style: normal;
    font-weight: bold;
    src: local(‘Prompt Bold’), local(‘Prompt-Bold’), url(<?php echo $this->get_template_path(); ?>/fonts/prompt-bold.ttf) format (‘truetype’);
    }
    @font-face {
    font-family: ‘Prompt’;
    font-style: italic;
    font-weight: normal;
    src: local(‘Prompt Italic’), local(‘Prompt-Italic’), url(<?php echo $this->get_template_path(); ?>/fonts/prompt-italic.ttf) format (‘truetype’);
    }
    @font-face {
    font-family: ‘Prompt’;
    font-style: italic;
    font-weight: bold;
    src: local(‘Prompt Bold Italic’), local(‘Prompt-BoldItalic’), url(<?php echo $this->get_template_path(); ?>/fonts/prompt-bolditalic.ttf) format (‘tryetype’);
    }

    2.The full Path is theme-child/woocommerce/pdf/customizedsimple/style.css

    3 In the folder of customizedsimple in theme-child;
    -fonts/Prompt
    -html-document-wrapper.php
    -invoice.php
    -packing-slip.php
    -style.css
    -template-functions.php

    except style.css which I paste the above code, the rest I copy from “simple” folder in parent theme.

    4. I also assign that font family to the body of the template as mentioned in Custom Fonts.

    5. I have changed the General setting to “Customizedsimple”

    But I still get square in PDF file.

    Please kindly advise.
    thank you very much.

    Plugin Contributor Ewout

    (@pomegranate)

    It looks like small errors keep sneaking into your code for some reason: There’s a typo tryetype in your CSS.

    You mention that the fonts are in fonts/Prompt is that a folder? Can you show a screenshot of the entire folder structure?

    Have you verified that the custom template is loading by adding something like “Hello World” to the top of one of the documents?

    Thread Starter mildqqwild

    (@mildqqwild)

    Hi,

    Thank you and sorry for my error. I already edited it. Please see the folder structure in my child theme. https://ibb.co/NVvSdBt.

    For verifying, I have added the word “Hello World” but it did not come out in my invoice. https://ibb.co/Bwrqvhg

    Before I changed my theme to child theme, I also add the hello world in invoice (simple folder), it did not come out as well..???? don’t know why.

    thank you for your advise.

    Plugin Contributor Ewout

    (@pomegranate)

    That helps.
    I would do two things:

    • Copy the fonts to the /fonts/ folder, removing that additional Prompt folder (since your CSS declaration does not include that Prompt folder either: <?php echo $this->get_template_path(); ?>/fonts/prompt.ttf)
    • Rename your custom template folder from “Customizedsimple” to “Prompt” so that there’s no possibility that there’s another folder (in the plugin for example) with the same name. Select this “Prompt” template in the General settings tab.

    If the “Hello World” text still doesn’t show up, I don’t know what is wrong. I’m assuming you’re only using the free plugin and not our Professional extension?

    Thread Starter mildqqwild

    (@mildqqwild)

    Hi,

    I do some changes in folder per your recommendation and change the template to be “Prompt” as well . https://ibb.co/30Vh82n

    I got “Hello World” in woocommerce invoice, but I cannot find “Hello World” from WCFM invoice.

    But I cannot get Thai in both invoices.

    I bought the multivendor ultimate from WCFM and it links to your plugin. I have no problem to buy your professional version if it can help me to solve this problem.

    BTW, for System Configuration, I got the orange tap of GMagick or IMagick => Better with transparent PNG images ” No. Recommended for better performances” I am not sure whether it concerns to this issue .

    thank you for your advise.

    Plugin Contributor Ewout

    (@pomegranate)

    It seems the filenames in your stylesheet still do not match the actual filenames in your folder. In your CSS you have /fonts/prompt.ttf but it looks like the actual filenames are capitalized and I think you also need something like “Prompt-Regular” (this is cut off in your screenshot though, so it’s just a guess).
    From the ones in your screenshot, you could try these changes:
    /fonts/prompt.ttf => /fonts/Prompt-Medium.ttf
    /fonts/prompt-bold.ttf => /fonts/Prompt-Bold.ttf
    /fonts/prompt-italic.ttf => /fonts/Prompt-MediumBold.ttf
    /fonts/prompt-bolditalic.ttf => /fonts/Prompt-BoldItalic.ttf

    You could also try Prompt-Regular.ttf and Prompt-RegularBold.ttf instead of Medium if those files exist.

    I think the overall lesson throughout this forum thread is that you need to make sure that the files that you are linking to actually exist in that location with that exact name. You have made a lot of typos and unfortunately computers are not smart enough yet to automatically correct those typos for you ??

    For WCFM you’ll need to contact their support, they use their own templates.

    I have no problem to buy your professional version if it can help me to solve this problem.

    That would certainly make things easier. We have a Thai font pack for our paying customers that is a simple addon that you install – no files/CSS required at all, just good old plug & play ??

    Thread Starter mildqqwild

    (@mildqqwild)

    Hi,

    Thank you very much. Hoorey!!! I can do it now. I delete all related plugins and reinstall. The cause of this issue because of woocommerce-pdf-ips-mpdf, I follow the instruction of ultimate version for font issue. Once I delete this plugin, everything is back to normal ??

    thank you very much for your help and support. Certainly, I will look through your plugin to fill my website.

    thanks again.
    tid

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘WooCommerce PDF Invoices & Packing Slips’ is closed to new replies.