• Resolved frederikc

    (@frederikc)


    Hi,
    I have created a new template for packing-slip and included the barcode font (ttf format), and it shows fine in the HTML debug, but not in pdf version.

    Can you point me in the right direction about what could be wrong?

    I have linked to a zipped version of the template on dropbox.

    Notice – url to font is hardcoded in style.css (needs to be changed for you to test)

    The page I need help with: [log in to see the link]

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

    (@pomegranate)

    I haven’t looked at your zip yet, but you can’t load fonts remotely, here’s a guide that should help: https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/using-custom-fonts/

    If you already followed that but it’s not showing, could you post the relevant CSS here?

    Thread Starter frederikc

    (@frederikc)

    /* BARCODE FONT */

    @font-face {
    font-family: ‘barcode’;
    font-style: normal;
    font-weight: normal;
    src: local(‘barcode’), local(‘barcode’), url(https://www.ccf-test.dk/wp-content/themes/flatsome-child/woocommerce/pdf/CCF/fonts/barcode.ttf) format(‘truetype’);
    }

    .barcode {
    font-family: ‘barcode’;
    }

    Thread Starter frederikc

    (@frederikc)

    Site is running on ccf-test.dk FYI

    Plugin Contributor Ewout

    (@pomegranate)

    As written in the documentation, you need to use the local path rather than the URL (and you won’t see the result in HTML unless you have installed the font on your computer).

    Thread Starter frederikc

    (@frederikc)

    Already tried that, does not make any change.
    Still only shows on HTML debug, but not on pdf.

    “/wp-content/themes/flatsome-child/woocommerce/pdf/CCF/fonts/barcode.ttf”

    Plugin Contributor Ewout

    (@pomegranate)

    That’s not the full path though, you need everything before /wp-content too, like so:

    
    url(<?php echo $this->get_template_path(); ?>/fonts/barcode.ttf)
    

    Can you test with a regular/non-barcode font to make sure it’s not related to the font itself?

    Thread Starter frederikc

    (@frederikc)

    It shows correctly in HTML so path is right and I don’t have the font installed located.

    Plugin Contributor Ewout

    (@pomegranate)

    The problem is that server side generation works different from local viewing. The PDF is created on the server and needs to read the complete path. As a result, the browser will not be able to find the font (since it cannot read files directly from the server), but the PDF can. So if you’re seeing the font loaded in the browser, it’s an indication that you haven’t used the correct path.

    Can you use the aforementioned format and also test with a non-barcode font to make sure that it’s not a problem with the font (the PDF generator doesn’t play nice with all fonts).

    Thread Starter frederikc

    (@frederikc)

    That were it! Thank you for your help it works now! ??

    Plugin Contributor Ewout

    (@pomegranate)

    Glad to hear that ??
    When you say “that was it” – what exactly? The font or the path?

    Thread Starter frederikc

    (@frederikc)

    The path ??

    Thread Starter frederikc

    (@frederikc)

    Now I have a barcode on the picking-slip that can be used for pickingpal. Next mission is to add locations ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Include barcode font on pdf’ is closed to new replies.