Giter Club home page Giter Club logo

Comments (2)

jsiefer avatar jsiefer commented on June 19, 2024

Hi (otf, ttf, woff (not woff2)) should work.

Most likely there is an issue with the path mapping. Sadly the Laravel plugin does "swallow" those warnings at the moment. If you can xdebug into it, checkout \Typesetsh\LaravelWrapper\Typesetsh::render() and check the $this->uriResolver->errors after html2pdf->render is called.

Since its its properly relative to your project root, you can try to do:

@font-face {
    font-family: "Inter";
    src: url("./fonts/Inter-Regular.ttf") format("ttf");
    /* I also tried src: url("/fonts/Inter-Regular.ttf") format("ttf"); */
    font-weight: 400;
}
'allowed_directories' => [
    public_path(),
],
'base_dir' => public_path(),

Doing above should tell the UriResolver to prepend the public path to all ./ resources.


  • Improve error reporting using the UriResolver
  • default base path should probably be empty string

from laravel-wrapper.

RobertCordes avatar RobertCordes commented on June 19, 2024

Ok so setting 'base_dir' => public_path() actually helped. When using @font-face directly inside the HTML head, I could declare the path as ./fonts/.... Also, when using an external stylesheet, I have to set it as ../fonts/.... Which makes sense of course, but I just realised that now. That also means that I didn’t really have to mess with the configuration in the first place, sorry about that.

One note though: my .ttf font still doesn’t work, but my .woff does. It’s not really a problem for me though 😉

from laravel-wrapper.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.