Easiest is if the font is available online. Then you would just add a @import or @font-face in your CSS.
That and some other options are in listed here: https://stackoverflow.com/questions/24412203/dompdf-and-set-different-font-family
i need to generate PDF with Japanese font but i don't how to change . i hope anyone can here give me some good advice.thanks in advance.
@chask This isn't related to Laravel but specific to dompdf.
Is the font you want to use available online? If is was say a google font, then you could use css to style your page.
Using @import
<style>
@import url('https://fonts.googleapis.com/css?family=Roboto');
</style>
And style your page with font-family: 'Roboto', sans-serif;
Or alternatively using @font-face
@font-face {
font-family: 'Firefly';
font-style: normal;
font-weight: normal;
src: url(http://example.com/fonts/firefly.ttf) format('truetype');
}
If your font is not available from a url. Then your other option would be to load it into dompdf from the command line.
You would need to install the load_font.php script from https://github.com/dompdf/utils More info can be found here also: https://github.com/dompdf/dompdf/wiki/UnicodeHowTo#load-a-font-supporting-your-characters-into-dompdf
Please or to participate in this conversation.