Comments (2)
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-wrapper.