laravel-dompdf icon indicating copy to clipboard operation
laravel-dompdf copied to clipboard

dompdf, Laravel Vapor and CSS font link error - fopen in /tmp/storage/fonts, no such file or directory

Open Jamiewarb opened this issue 3 years ago • 6 comments

Hi there,

When attempting to use dompdf with Laravel Vapor and importing a google font via CSS import, I'm getting the following issue:

fopen(/tmp/storage/fonts/work_sans_normal_d6eeffee426555fe4bcfe67ec779bf1d.ufm): Failed to open stream: No such file or directory

The font link I'm using is

<link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;600&display=swap" rel="stylesheet">

It gets to dompdf's FontMetrics methods, and then tries to open this file using fopen('/tmp/storage/fonts/work_sans_normal_d6eeffee426555fe4bcfe67ec779bf1d.ufm', w+), and fails with this error.


I read the following PR within this repo, which mentions setting dompdf's font cache etc to /tmp: https://github.com/barryvdh/laravel-dompdf/issues/687

However, from the error message, it looks like this is already set to /tmp, as it's trying to open this file there.

Has anyone else gotten dompdf to work with Laravel vapor and a custom font?

Jamiewarb avatar Oct 17 '22 17:10 Jamiewarb

Try to create manually that path and try again, also try this https://github.com/barryvdh/laravel-dompdf/issues/915#issuecomment-1273556405

angeljqv avatar Oct 18 '22 17:10 angeljqv

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

stale[bot] avatar Jun 18 '23 08:06 stale[bot]

@Jamiewarb Have you found a solution for this problem Jamie? Facing the exact same problem and nothing has helped yet.

akinsariozkan avatar Oct 17 '23 22:10 akinsariozkan

same problem

MenC-Didam avatar Nov 27 '23 17:11 MenC-Didam

same problem

drpark avatar Jan 24 '24 15:01 drpark

Found solution see: https://stackoverflow.com/questions/77529293/laravel-vapor-docker-dompdf-not-rendering-custom-fonts-works-locally-not-on/77559111#77559111

sietse85 avatar Jan 24 '24 16:01 sietse85