Font not loading inside PDF #2857
Replies: 7 comments 7 replies
-
If you've correctly loaded the fonts then you shouldn't need to use Are you loading the HTML into Dompdf using Lastly, how are you applying the font to your document? You showed the |
Beta Was this translation helpful? Give feedback.
-
1st answer: I'm writing everything in an extended php variable then using loadHtml to load the single variable which works out great except for that single font issue. then assigning the class. I've tried with both absolute and relative locations and so far both have not worked. they both seem to fall back to the backup font. If you're telling me that i'm doing everything right from your view, then it's probably something stupid on my side. and I just tried assigning a font-weight both of normal and 400 and both of them make the pdf not create (I create the pdf file then i echo the variable to see if something is missing) so that may point to something. |
Beta Was this translation helpful? Give feedback.
-
Good morning Brian, I was up till about 1 AM last night playing with my code and fighting with the font. I commented out most of my code except for 3 lines, then tried to add that font (as a class) to the html element, nothing. I even went so far as to rebuilt the cache for the fonts. still nothing has worked. I also just tried to change the permissions on dompdf to 775 just to make sure it wasn't a permissions issue and it still didn't load the font. When I set the temp directory to my temp folder, I can see it creating the logo png temp file but not the font one. I have 2 other fonts loading from google fonts which work perfectly, just not this one. i'm not sure what else to try. You're saying it should be working fine, either with @font-face or actually adding it into loading it into dompdf with the font_load.php file and it's not, so either i'm loading it wrong, or it's being loaded into dompdf wrong. (it's probably me) The one thing I did notice (Though I could be wrong) is that the when I check the dompdf_font_familt_cache.php against the dompdf_font_familt_cache.dist.php, one is using brackets as its array, and one is using braces, do you think maybe when using font_load.php, it's loading my font info into the wrong file? Just wondering. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Ok, So i've been playing with this off and on all day. and I've come up with 2 reasons.
As I said, Dom's a great pdf maker so i'm going to keep digging at this and maybe i'll find something. but I'm considering the issue as being on my side more than anything else now. Thanks for your help! |
Beta Was this translation helpful? Give feedback.
-
Ok, I just did a debug in my IDE and literally followed through the code and saw this: So this explains ALOT on why it wouldn't load the font in the editor! So we can consider this issue fixed then. it's definitely a my side issue more than anything. Thank you for all your help Brian!! |
Beta Was this translation helpful? Give feedback.
-
After getting the chroot and the directories set right for the fonts and such, i was able to get it passed the permission denied hump but now i've run into something even more amusing. I checked the FontLib\Table\Type folder and I don't have a fftm.php file. so it's trying to load from my auto loader for my site and of course it won't find it in my auto loader, so now it's failing crashing because it can't find that table. I checked the the php-font-lib section here: https://github.com/dompdf/php-font-lib/tree/master/src/FontLib/Table/Type just to make sure I wasn't missing any files and I didn't see a table type there for that name either. https://www.fontforestry.com/autography-font-free-download/ This is where I got the file from if you want to do any testing with that font. Did I mention I love DOMpdf and I appreciate all the hard work you put into this code? :) -Joshua |
Beta Was this translation helpful? Give feedback.
-
I am so happy to announce, after fighting with this for 2-3 days, I finally got the font to show up right on the pdf file, @bsweeney, you pointed me in the right direction with having to build that ttfm table, then a couple other tables showed up so i did the same thing. I also took the AFM file that i converted with the ttf file, and copy/pasted that as a umf file (it looks like the AFM vs UMF stuff isn't copying over right) and tried it again and everything magically worked. Thank you so much Brian! |
Beta Was this translation helpful? Give feedback.
-
Good evening,
First I want to say I love Dompdf and I hope sooner or later it gets bootstrap 4/5 and css3 support but that's another matter.
The problem I'm having right now is i'm trying to use a font called Autography and because it's not a google font, it's being a pain in the rear trying to load it.
Things I've done so far:
I've loaded the font into the dompdf font directory using load_font.pdf and checked the dompdf_font_family_cache.php file to make sure it loaded the files in there.
and made sure that the file was a ttf file.
and also here's my directory setup if you need to figure out why i did stuff the way I did :p
the ending result is the font falls back to the backup font and doesn't seem to want to load. My bosses paid for the font use for commercial use so I'd like to be able to get it working.
Everything else loads up great, using bootstrap 3.3.7 i was able to get a shipping manifest built and everything, it's just the last part of this project is getting 1 paragraph changed to that font. and i've been racking my brain pouring over google trying to find the answer. and nothing I have found seems to help so far so I'm taking it to the pros!
so if you have any suggestions or ideas, please let me know.
Beta Was this translation helpful? Give feedback.
All reactions