• Resolved Zurasha

    (@w3intelligence)


    Hi,

    I’m using this plugin and want to print Georgian characters in PDF.

    I tried default ‘sans-serif’ and custom font(Georgian) but still “?” replaces any Georgian character.

    Under PDF Invoices->Status, i checked MBString extension and it says OK in green field.

    I also checked “Output to HTML” on and html output works properly, but pdf results same.

    What should i do to fix this character problem?

    Photo of PDF Invoice : https://prntscr.com/r4mf3u

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @w3intelligence,

    You say: “I tried default ‘sans-serif’“.
    Do you mean you’ve tried to generate a PDF with the installed default font (which is Open Sans)?

    Having multiple question marks like this in your document does suggest MBString is not active. It could be the case that the status tab is giving a false positive in this case. You can check with your host if MBString is really activated on your domain.

    Also is it possible for you to send us (some of) the Georgian characters you would like to use so we can test it here locally as well? Thank you in advance!

    Thread Starter Zurasha

    (@w3intelligence)

    Hi, @kluver,

    Yes, i tried with Open Sans, also with Georgian font and sans-serif. Neither worked as expected.

    I checked MBString extension and it is really activated with PHP 7.2

    Some Georgian characters are ????????, ?????????, ??????, ?????.

    I’ll be glad if you check and give me solution around this.

    Thanks in advance.

    • This reply was modified 4 years, 9 months ago by Zurasha.
    Plugin Contributor Ewout

    (@pomegranate)

    Hi! It looks like Georgian characters are indeed not included in Open Sans (and as Micheal mentioned, ‘sans-serif’ is not a font used by default with this plugin).

    Can you share the Georgian font that you tried to use?

    Thread Starter Zurasha

    (@w3intelligence)

    Hi,

    This is Georgian font i tried to use. https://we.tl/t-f5WiKHZklW

    Thank you for support.

    Plugin Contributor Ewout

    (@pomegranate)

    Thanks! Can you also share the CSS that you used to for this?

    Thread Starter Zurasha

    (@w3intelligence)

    Hello there,

    i used this hook to apply CSS searched on internet.

    This works well if i enable HTML5 output but not in pdf.

    Thanks,

    add_action(‘wpo_wcpdf_custom_styles’, function($type, $pdf) {
    $template_path = $pdf->get_template_path();
    $css = <<<CSS

    @font-face {
    font-family: ‘BPG Mrgvlovani Caps’;
    font-style: normal;
    font-weight: normal;
    src: url(mydomain.loc/app/uploads/sites/5/fonts/bpg-mrgvlovani-caps-webfont.ttf) format(‘truetype’);
    }
    .address,
    .shop-name h3,
    .item-name,
    body {
    font-family: ‘BPG Mrgvlovani Caps’ !important;
    }
    CSS;
    echo $css;
    }, 10, 2);

    Plugin Contributor Ewout

    (@pomegranate)

    Thanks for sharing that. With a small modification (your URL is local to you), this worked fine for me.
    I think there are 2 possible reasons this didn’t work for you:

    • You used a URL but it’s possible your server does not allow remote resources do be downloaded (note that this is different from what the browser downloads – the fonts for the PDF need to be downloaded to the server)
    • You only specified the ‘normal’ font weight but not the ‘bold’ font weight

    Here’s what worked for me (I put the font in my site root for testing, to which ABSPATH is the full path):

    
    add_action('wpo_wcpdf_custom_styles', function($type, $pdf) {
    	$template_path = $pdf->get_template_path();
    	$abspath = untrailingslashit( ABSPATH );
    	$css =
    <<<CSS
    
    	@font-face {
    		font-family: 'BPG Mrgvlovani Caps';
    		font-style: normal;
    		font-weight: normal;
    		src: url('$abspath/bpg-mrgvlovani-caps-webfont.ttf') format('truetype');
    	}
    	@font-face {
    		font-family: 'BPG Mrgvlovani Caps';
    		font-style: normal;
    		font-weight: bold;
    		src: url('$abspath/bpg-mrgvlovani-caps-webfont.ttf') format('truetype');
    	}
    	.address,
    	.shop-name h3,
    	.item-name,
    	body {
    		font-family: 'BPG Mrgvlovani Caps' !important;
    	}
    CSS;
    	echo $css;
    }, 10, 2);
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Getting “????” instead of characters’ is closed to new replies.